Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rasschaert/8508840 to your computer and use it in GitHub Desktop.
Save rasschaert/8508840 to your computer and use it in GitHub Desktop.
Creates an RPM package for Sublime Text 3 beta
#!/bin/bash
echo "Creating directory structure"
mkdir -p ./tmproot/usr/bin
mkdir -p ./tmproot/usr/share/applications
mkdir -p ./tmproot/usr/share/icons/hicolor
mkdir -p ./tmproot/usr/share/icons/gnome
mkdir -p ./tmproot/opt/
echo "Downloading archive"
cd ./tmproot/opt
wget http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3059_x64.tar.bz2
echo "Extracting archive"
tar xjf sublime_text_3_build_3059_x64.tar.bz2
rm sublime_text_3_build_3059_x64.tar.bz2
echo "Creating shortcut"
# Normally I'd prefer to put it in /usr/local/bin/,
# but the oh-my-zsh sublime plugin expects it to be at /usr/bin/
cd ../usr/bin/
ln -s ../../opt/sublime_text_3/sublime_text .
echo "Creating launcher"
cd ../../
sed -i 's|^Exec=/opt/sublime_text|Exec=/usr/bin|' opt/sublime_text_3/sublime_text.desktop
cp ./opt/sublime_text_3/sublime_text.desktop ./usr/share/applications
chmod 644 ./usr/share/applications/sublime_text.desktop
echo "Placing icon"
cd ./opt/sublime_text_3/Icon
for i in $(ls); do
mkdir -p ../../../usr/share/icons/hicolor/$i/apps/
cp ./$i/sublime-text.png ../../../usr/share/icons/hicolor/$i/apps/
mkdir -p ../../../usr/share/icons/gnome/$i/apps/
cp ./$i/sublime-text.png ../../../usr/share/icons/gnome/$i/apps/
done
echo "Creating package"
cd ../../../../
fpm -s dir -t rpm -n sublime-text -v 3.0.3059beta -a x86_64 -C tmproot .
echo "Cleaning up"
rm -rf tmproot
echo 'Done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment