Skip to content

Instantly share code, notes, and snippets.

@jaka
Created January 13, 2015 23:38
Show Gist options
  • Save jaka/62cad90a7b8cd1003c6d to your computer and use it in GitHub Desktop.
Save jaka/62cad90a7b8cd1003c6d to your computer and use it in GitHub Desktop.
Simple script for installing sublime text editor on Debian (and probably on some another distro)
#!/bin/sh
URL="http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.tar.bz2"
URL64="http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2%20x64.tar.bz2"
LOCALDIR=/usr/local
[ "`uname -m`" = "x86_64" ] && URL="$URL64"
[ "`id -u`" = "0" ] || (echo "You should run this script as root" && exit 1)
wget -nv $URL -O - | tar -C "$LOCALDIR" -xvjf -
mv "$LOCALDIR/Sublime Text 2" "$LOCALDIR/sublime-text-2"
ln -s "$LOCALDIR/sublime-text-2/sublime_text" "$LOCALDIR/bin/sublime_text"
for _i in `ls -1 "$LOCALDIR/sublime-text-2/Icon/"`; do
TARGETDIR="/usr/share/icons/hicolor/$_i/apps/"
SOURCEDIR="$LOCALDIR/sublime-text-2/Icon/$_i"
[ -d "$TARGETDIR" ] || mkdir -p "$TARGETDIR"
ln -s "$SOURCEDIR/sublime_text.png" "$TARGETDIR/sublime_text.png"
done
if [ -x /usr/bin/gtk-update-icon-cache-3.0 ]; then
/usr/bin/gtk-update-icon-cache-3.0 --force --quiet /usr/share/icons/hicolor
elif [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache --force --quiet /usr/share/icons/hicolor
fi
cat <<EOF >"/usr/share/applications/sublime_text.desktop"
[Desktop Entry]
Name=Sublime Text 2
Exec=$LOCALDIR/bin/sublime_text
Type=Application
Icon=sublime_text
Categories=Development;TextEditor
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment