Skip to content

Instantly share code, notes, and snippets.

@jacksonwillis
Created December 11, 2011 04:41
Show Gist options
  • Save jacksonwillis/1458386 to your computer and use it in GitHub Desktop.
Save jacksonwillis/1458386 to your computer and use it in GitHub Desktop.
Wget Hello test
# Usage: 'wget tinyurl.com/wgethello && bash wgethello'
ORIGIN=`pwd`
FILE_HELLO=wgethello
FILE_LAUNCHER="$HOME/Desktop/Nyan Cat.desktop"
URL_ICON=http://i.imgur.com/edQKe.gif
NYAN_DIR=$HOME/.nyan
hr () { echo "--------"; }
br () { echo; }
exit_cleanup () { bash -c "sleep 5; rm $ORIGIN/$FILE_HELLO >/dev/null 2>&1" & }
confirm () {
read -r -p "Are you sure you want to continue? [Y/n] " response
case $response in
[yY][eE][sS]|[yY])
;;
*)
exit_cleanup; exit
;;
esac
}
rm $FILE_HELLO* >/dev/null 2>&1
# Greetings
clear
echo "Welcome to the Wget Hello test!"
hr
br
# Warning
echo "This script, although harmless, creates a launcher file on the desktop."
confirm
# Get .desktop file
br
echo "Installing launcher..."
hr
cd $HOME/Desktop
rm $FILE_LAUNCHER* >/dev/null 2>&1
br
echo <<END
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=telnet miku.acm.uiuc.edu
Terminal=true
Icon=$HOME/.nyan/nyan.gif
Name[en_US]=Nyan Cat
Comment[en_US]=NYAN NYAN NYAN NYAN
END > $FILE_LAUNCHER
chmod a+x $FILE_LAUNCHER
hr
br
rm -r $NYAN_DIR >/dev/null 2>&1
rmdir $NYAN_DIR >/dev/null 2>&1
mkdir $NYAN_DIR
cd $NYAN_DIR
echo "Downloading program files..."
hr
wget -nv -O nyan.gif $URL_ICON
br
echo "Installation complete."
exit_cleanup
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=telnet miku.acm.uiuc.edu
Terminal=true
Icon=~/.nyan/nyan.gif
Name[en_US]=Nyan Cat
Comment[en_US]=NYAN NYAN NYAN NYAN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment