-
-
Save aktau/5330470 to your computer and use it in GitHub Desktop.
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 | |
# set -e | |
set -u | |
AKBREW_CELLAR="/usr/local/aktau" | |
CURRENT_USER=$(whoami) | |
# create AKBREW_CELLAR if it does not exist | |
# using sudo instead of adding self to staff... | |
[[ -d "$AKBREW_CELLAR" ]] || { | |
sudo mkdir -m 755 "$AKBREW_CELLAR" && \ | |
sudo chown $CURRENT_USER:$CURRENT_USER "$AKBREW_CELLAR" | |
} | |
SRCNAME="st2" | |
SRCFILE="${SRCNAME}.tar.bz2" | |
UNPACKEDDIR="Sublime Text 2" | |
DSTDIR="$AKBREW_CELLAR/sublime-text-2" | |
# -nc is --no-clobber, i.e.: don't overwrite | |
# if the file already exists | |
echo "Getting..." | |
wget -nc -O "$SRCFILE" "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" | |
# unpack | |
echo "Unpacking..." | |
tar -xvjf "$SRCFILE" | |
[[ -d "$DSTDIR" ]] || mkdir -p "$DSTDIR" | |
echo "Removing...$DSTDIR/*" | |
rm -rfv "$DSTDIR/*" | |
mv -v "$UNPACKEDDIR"/* "$DSTDIR" | |
# make symlinks | |
sudo ln -s "$DSTDIR/sublime_text" /usr/local/bin/subl && \ | |
sudo chown $CURRENT_USER:$CURRENT_USER /usr/local/bin/subl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment