Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Gist to install Sublime Text 3 on RHEL 6 +
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/opt/sublime_text_3/sublime_text
Icon=/opt/sublime_text_3/Icon/128x128/sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
SCRIPT="#!/bin/sh
if [[ \${1} == \"--help\" ]]; then
/opt/sublime_text_3/sublime_text --help
else
/opt/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 &
fi"
echo "Downloading Sublime Text 3..."
curl -L "https://download.sublimetext.com/sublime_text_3_build_3114_x64.tar.bz2" -o "/usr/src/Sublime Text 3.tar.bz2"
echo "Installing Sublime Text 3..."
echo -ne '##### (33%)\r'
cd /usr/src
tar -xvjf "Sublime Text 3.tar.bz2"
echo -ne '############# (66%)\r'
cd "sublime_text_3"
mv -fv "/usr/src/sublime_text_3" "/opt/sublime_text_3"
echo "${SCRIPT}" > "/usr/local/bin/subl"
chmod +x "/usr/local/bin/subl"
echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-3.desktop"
ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime3
echo -ne '####################### (100%)\r'
# Package Control - The Sublime Text Package Manager: https://sublime.wbond.net
echo "Installing Package Control..."
wget --no-check-certificate https://sublime.wbond.net/Package%20Control.sublime-package
sudo mv Package\ Control.sublime-package "/opt/sublime_text_3/Packages/"
cd .config/sublime-text-3/Installed\ Packages/
wget https://packagecontrol.io/Package%20Control.sublime-package
echo "Finish!"

sublime_text_3 -> sublime-text-3

hi there, just a couple fixes for Fedora 21

first there are a couple problems with the script:

line21

cd "Sublime Text 3"

When you decompress the tar.bz2 file it contains a sublime_text_3 folder, no this line results in "not found"

line23

mv -fv * "/opt/sublime-text-3/"

That will move all the content of /usr/src to /opt/sublime-text-3/ (and its a pain, if you have stuff there)
You can easily merge lines 22 and 23 into

mv -fv "/usr/src/sublime_text_3" "/opt/sublime_text_3"

take into account no trailing / at the end because you would move sublime_text_3 into another sublime_text_3 folder creating /opt/sublime_text_3/sublime_text_3

with that fixed now only line12 needs a fix

if [[ \${1} == \"--help\" ]]; then

and thats it 😄

Great!
There was another new update : Build 3083
I believe it to change the file to be downloaded as well.

Owner

sayak-sarkar commented Feb 24, 2016

Fixed the Tarball link and updated the gist to the latest 3103 build along with all of @ThePhoenixBird's fixes! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment