Created
August 6, 2013 10:50
-
-
Save serkaniyigun/6163519 to your computer and use it in GitHub Desktop.
bash script install Sublime Text 2 on Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sublime Text 2.0.2 install script | |
# Confirmation | |
echo 'Proceed with installing Sublime Text 2.0.2?' | |
echo '1. Yes' | |
echo '2. No' | |
echo '' | |
read REPLY | |
if [ $REPLY == 1 ]; then | |
# Downloading Sublime Text 2 | |
cd $HOME/Downloads | |
echo 'Downloading Sublime Text 2.0.2...' | |
# Download tarball that matches system architecture | |
if [ $(uname -i) = 'i386' ]; then | |
wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.tar.bz2 | |
elif [ $(uname -i) = 'x86_64' ]; then | |
wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2%20x64.tar.bz2 | |
fi | |
# Extract Tarball | |
cd $HOME/Downloads | |
echo 'Extracting Sublime Text 2.0.2...' | |
tar xf Sublime*.tar.bz2 | |
# Move Sublime Text 2 to /opt | |
echo 'Installing...' | |
echo 'Requires root privileges:' | |
sudo mv Sublime\ Text\ 2 /opt/ | |
echo 'Done.' | |
# Create symbolic link | |
echo 'Creating symbolic link...' | |
echo 'Requires root privileges:' | |
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime | |
echo 'Done.' | |
# Create .desktop file | |
echo 'Creating .desktop file...' | |
touch sublime-text.desktop | |
echo "[Desktop Entry] | |
Version=2 | |
Name=Sublime Text 2 | |
GenericName=Text Editor | |
Exec=sublime | |
Terminal=false | |
Icon=/opt/Sublime Text 2/Icon/256x256/sublime_text.png | |
Type=Application | |
Categories=TextEditor;IDE;Development | |
X-Ayatana-Desktop-Shortcuts=NewWindow | |
[NewWindow Shortcut Group] | |
Name=New Window | |
Exec=sublime -n | |
TargetEnvironment=Unity" >> sublime-text.desktop | |
# Move .desktop file | |
echo 'Moving .desktop file to /usr/share/applications' | |
sudo mv -f sublime-text.desktop /usr/share/applications/ | |
echo 'Done.' | |
# Cleanup & finish | |
rm Sublime*.tar.bz2 | |
cd | |
clear && echo '' | |
echo 'Installation of Sublime Text 2 complete.' | |
exit | |
elif [ $REPLY == 2 ]; then | |
exit | |
else | |
clear && echo 'Error, try again.' | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment