Last active
August 29, 2015 14:07
-
-
Save trivoallan/9a4b16cd23b3c2a8c0d3 to your computer and use it in GitHub Desktop.
Sublime Text 3 local installer
This file contains hidden or 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 | |
| # Downloads Sublime Text 3 and installs it locally in user's home directory | |
| # Better error reporting | |
| function error_handler() { | |
| echo "Error occurred in script at line ${1}" | |
| echo "Line exited with status: ${2}" | |
| } | |
| trap 'error_handler ${LINENO} $?' ERR | |
| # Fail fast ! | |
| set -o errexit | |
| set -o errtrace | |
| set -o nounset | |
| # Check already existing installation | |
| if [ -d "$HOME/sublime_text_3" ]; then | |
| echo "Sublime Text 3 is already installed in $HOME/sublime_text_3. Aborting." | |
| exit 255 | |
| fi | |
| # Download ST3 | |
| urlDownload="http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3065_x32.tar.bz2" | |
| cd $HOME | |
| wget $urlDownload | |
| # Extract archive | |
| tar xjf $(basename $urlDownload) | |
| # Tell the world ! | |
| echo | |
| echo "Launch Sublime Text 3 by executing the following command :" | |
| echo | |
| echo " cd $HOME/sublime_text_3 && ./sublime_text" | |
| echo | |
| echo "Bisous !" | |
| echo | |
| # Exit successfully | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment