Created
January 21, 2016 20:27
-
-
Save alice-em/0c7a6038b863a1c7f128 to your computer and use it in GitHub Desktop.
Revisions
-
henriquemoody revised this gist
Nov 19, 2013 . 1 changed file with 70 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,78 @@ #!/usr/bin/env bash # Usage: {script} [ OPTIONS ] TARGET VERSION # # TARGET Default target is "/usr/local". # VERSION If not defined tries to get the build into the Sublime Text 2 website. # # OPTIONS # # -h, --help Displays this help message. # # Report bugs to Henrique Moody <[email protected]> # set -e if [[ "${1}" = '-h' ]] || [[ "${1}" = '--help' ]]; then sed -E 's/^#\s?(.*)/\1/g' "${0}" | sed -nE '/^Usage/,/^Report/p' | sed "s/{script}/$(basename "${0}")/g" exit fi declare URL declare URL_FORMAT="http://c758482.r82.cf2.rackcdn.com/%s.tar.bz2" declare PACKAGE="Sublime Text" declare TARGET="${1:-/usr/local}" declare VERSION="${2}" declare BITS=$(uname -m) if [[ -z "${VERSION}" ]]; then VERSION=$( curl -Ls http://www.sublimetext.com/2 | grep '<h2>Version' | head -n1 | sed -E 's#<h2>Version ([0-9.]+)</h2>#\1#g' ) fi PACKAGE+=" ${VERSION}" if [[ "${BITS}" = "x86_64" ]]; then PACKAGE+=" x64" fi URL=$(printf "${URL_FORMAT}" "${PACKAGE}" | sed 's/ /%20/g') read -p "Do you really want to install \"${PACKAGE}\" on \"${TARGET}\"? [Y/n]: " CONFIRM CONFIRM=$(echo "${CONFIRM}" | tr [a-z] [A-Z]) if [[ "${CONFIRM}" = 'N' ]] || [[ "${CONFIRM}" = 'NO' ]]; then echo "Aborted!" exit fi echo "Downloading ${PACKAGE}" curl -L "${URL}" | tar -xjC ${TARGET} echo "Creating binary file" cat > ${TARGET}/bin/subl <<SCRIPT #!/bin/sh if [ \${1} == \"--help\" ]; then ${TARGET}/sublime_text_3/sublime_text --help else ${TARGET}/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 & fi SCRIPT echo "Creating shortcut file" cat > "/usr/share/applications/sublime-text-2.desktop" <<SHORTCUT [Desktop Entry] Name=Sublime Text 2 Comment=Edit text files Exec=/usr/local/sublime-text-2/sublime_text Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png Terminal=false Type=Application Encoding=UTF-8 Categories=Utility;TextEditor; SHORTCUT echo "Finish!" -
henriquemoody revised this gist
Nov 19, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ if [[ "${1}" = '-h' ]] || [[ "${1}" = '--help' ]]; then exit fi declare URL declare URL_FORMAT="http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_%d_x%d.tar.bz2" declare TARGET="${1:-/usr/local}" declare BUILD="${2}" -
henriquemoody revised this gist
Nov 19, 2013 . 1 changed file with 71 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ #!/usr/bin/env bash # Usage: {script} [ OPTIONS ] TARGET BUILD # # TARGET Default target is "/usr/local". # BUILD If not defined tries to get the build into the Sublime Text 3 website. # # OPTIONS # # -h, --help Displays this help message. # # Report bugs to Henrique Moody <[email protected]> # set -e if [[ "${1}" = '-h' ]] || [[ "${1}" = '--help' ]]; then sed -E 's/^#\s?(.*)/\1/g' "${0}" | sed -nE '/^Usage/,/^Report/p' | sed "s/{script}/$(basename "${0}")/g" exit fi declare URL="http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_%d_x%d.tar.bz2" declare URL_FORMAT="http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_%d_x%d.tar.bz2" declare TARGET="${1:-/usr/local}" declare BUILD="${2}" declare BITS if [[ -z "${BUILD}" ]]; then BUILD=$( curl -Ls http://www.sublimetext.com/3 | grep '<h2>Build' | head -n1 | sed -E 's#<h2>Build ([0-9]+)</h2>#\1#g' ) fi if [[ "$(uname -m)" = "x86_64" ]]; then BITS=64 else BITS=32 fi URL=$(printf "${URL_FORMAT}" "${BUILD}" "${BITS}") read -p "Do you really want to install Sublime Text 3 (Build ${BUILD}, x${BITS}) on \"${TARGET}\"? [Y/n]: " CONFIRM CONFIRM=$(echo "${CONFIRM}" | tr [a-z] [A-Z]) if [[ "${CONFIRM}" = 'N' ]] || [[ "${CONFIRM}" = 'NO' ]]; then echo "Aborted!" exit fi echo "Downloading Sublime Text 3" curl -L "${URL}" | tar -xjC ${TARGET} echo "Creating shortcut file" cat ${TARGET}/sublime_text_3/sublime_text.desktop | sed "s#/opt#${TARGET}#g" | cat > "/usr/share/applications/sublime_text.desktop" echo "Creating binary file" cat > ${TARGET}/bin/subl <<SCRIPT #!/bin/sh if [ \${1} == \"--help\" ]; then ${TARGET}/sublime_text_3/sublime_text --help else ${TARGET}/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 & fi SCRIPT echo "Finish!" -
henriquemoody revised this gist
Aug 31, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,8 @@ fi" curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2" cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" cd "Sublime Text 2" mkdir -pv "/usr/local/sublime-text-2" mv -fv * "/usr/local/sublime-text-2/" echo "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" -
henriquemoody revised this gist
Aug 31, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,8 @@ curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2 cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mkdir -pv "/usr/local/sublime-text-2" cd "Sublime Text 2" mv -fv * "/usr/local/sublime-text-2/" echo "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,8 @@ fi" curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2" cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mkdir -pv "/usr/local/sublime-text-2" mv -fv "Sublime Text 2/*" "/usr/local/sublime-text-2/" echo "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ SCRIPT="#!/bin/sh if [ \${1} == \"--help\" ]; then /usr/local/sublime-text-2/sublime_text --help else /usr/local/sublime-text-2/sublime_text \$@ > /dev/null 2>&1 & fi" curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2" -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Type=Application Encoding=UTF-8 Categories=Utility;TextEditor;" SCRIPT="#!/bin/sh if [ \${1} == \"--help\" ]; then /usr/local/sublime-text-2/sublime_text --help else /usr/local/sublime-text-2/sublime_text $@ > /dev/null 2>&1 & -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ fi" curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2" cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mv -fv "Sublime Text 2" "/usr/local/sublime-text-2" echo "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,8 +19,8 @@ curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2 cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mv "Sublime Text 2" "/usr/local/sublime-text-2" echo "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" echo "Finish!" -
henriquemoody revised this gist
Aug 7, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,7 @@ cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mv "Sublime Text 2" "/usr/local/sublime-text-2" cat "${SCRIPT}" > "/usr/local/bin/subl" chmod +x "/usr/local/bin/subl" cat "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" echo "Finish!" -
henriquemoody created this gist
Aug 7, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/bin/sh SHORTCUT="[Desktop Entry] Name=Sublime Text 2 Comment=Edit text files Exec=/usr/local/sublime-text-2/sublime_text Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png Terminal=false Type=Application Encoding=UTF-8 Categories=Utility;TextEditor;" SCRIPT="#!/bin/sh if [ ${1} == \"--help\" ]; then /usr/local/sublime-text-2/sublime_text --help else /usr/local/sublime-text-2/sublime_text $@ > /dev/null 2>&1 & fi" curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2" cd /usr/src tar -xvjf "Sublime Text 2.tar.bz2" mv "Sublime Text 2" "/usr/local/sublime-text-2" cat "${SCRIPT}" > "/usr/local/bin/subl" cat "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop" echo "Finish!"