From ada0ffbe98adfc5ec8999c3ffb18812e08ba3e55 Mon Sep 17 00:00:00 2001 From: kunalbhatia Date: Tue, 7 Jan 2020 21:52:53 +0530 Subject: [PATCH 1/3] Create installer.sh --- installers/sublime text/installer.sh | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 installers/sublime text/installer.sh diff --git a/installers/sublime text/installer.sh b/installers/sublime text/installer.sh new file mode 100644 index 0000000..3fc37ce --- /dev/null +++ b/installers/sublime text/installer.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# Sublime Text 3 Install +# +# No need to download this script, just run it on your terminal: +# +# https://installer.to/sublimetext | bash + + +# Detect the architecture +if [[ "$(uname -m)" = "x86_64" ]]; then + ARCHITECTURE="x64" +else + ARCHITECTURE="x32" +fi + + +# Fetch the latest build version number +BUILD=$(echo $(curl http://www.sublimetext.com/3) | sed -rn "s#.*The latest build is ([0-9]+)..*#\1#p") + +URL="https://download.sublimetext.com/sublime_text_3_build_{$BUILD}_{$ARCHITECTURE}.tar.bz2" +INSTALLATION_DIR="/opt/sublime_text" + + +# Download the tarball, unpack and install +curl -o $HOME/st3.tar.bz2 $URL +if tar -xf $HOME/st3.tar.bz2 --directory=$HOME; then + sudo mv $HOME/sublime_text_3 $INSTALLATION_DIR + sudo ln -s $INSTALLATION_DIR/sublime_text /usr/local/bin/subl +fi +rm $HOME/st3.tar.bz2 + + +# Add to applications list and set icon +sed 's/Icon=sublime-text/Icon=\/opt\/sublime_text\/Icon\/128x128\/sublime-text.png/g' > $HOME/.local/share/applications/sublime_text.desktop + +echo ' +Sublime Text 3 installed successfully! +Run with: subl +' From 4dba76a48a1cbe718e4b858aa0035590ae1dc84b Mon Sep 17 00:00:00 2001 From: kunalbhatia Date: Tue, 7 Jan 2020 22:45:12 +0530 Subject: [PATCH 2/3] Update installer.sh --- installers/sublime text/installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installers/sublime text/installer.sh b/installers/sublime text/installer.sh index 3fc37ce..4f49150 100644 --- a/installers/sublime text/installer.sh +++ b/installers/sublime text/installer.sh @@ -10,8 +10,8 @@ # Detect the architecture if [[ "$(uname -m)" = "x86_64" ]]; then ARCHITECTURE="x64" -else - ARCHITECTURE="x32" +elif [[ "$(uname -m)" = "x86_32" ]]; then + ARCHITECTURE="x32" fi From e73ba8f443e98164021c4a8f36a5a52e00c85db7 Mon Sep 17 00:00:00 2001 From: kunalbhatia Date: Tue, 7 Jan 2020 22:49:39 +0530 Subject: [PATCH 3/3] Update installer.sh --- installers/sublime text/installer.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/installers/sublime text/installer.sh b/installers/sublime text/installer.sh index 4f49150..01fa6f3 100644 --- a/installers/sublime text/installer.sh +++ b/installers/sublime text/installer.sh @@ -4,7 +4,7 @@ # # No need to download this script, just run it on your terminal: # -# https://installer.to/sublimetext | bash +# curl https://installer.to/sublimetext | bash # Detect the architecture @@ -12,6 +12,8 @@ if [[ "$(uname -m)" = "x86_64" ]]; then ARCHITECTURE="x64" elif [[ "$(uname -m)" = "x86_32" ]]; then ARCHITECTURE="x32" +else + echo "Architecture not detected" fi