Files
shell/install/sublimetext
2025-06-21 22:48:29 +08:00

38 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
##makedesc: Install Sublime Text
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://www.sublimetext.com/download
# https://gist.axenov.dev/anthony/sublime
# https://gist.axenov.dev/anthony/sublime2
# https://gist.github.com/lugrus2000/1fc55158b87f94d799392a6dd1ac0ce2
# https://gist.github.com/maboloshi/feaa63c35f4c2baab24c9aaf9b3f4e47
[ "$1" ] && STVER="$1" || STVER='4200'
title
mkdir -p "$HOME/install"
DEB_PATH="$HOME/install/sublime-text_build-${STVER}_amd64.deb"
BIN_PATH="/opt/sublime_text/sublime_text"
if [[ ! -f "$DEB_PATH" ]]; then
download "https://download.sublimetext.com/sublime-text_build-${STVER}_amd64.deb" "$DEB_PATH"
fi
sudo dpkg -i "$DEB_PATH"
sudo cp -f "$BIN_PATH" "$BIN_PATH.old"
if [[ $STVER = 4169 ]]; then
echo "00489f39: c640 0501 4885 c9" | sudo xxd -r - "$BIN_PATH"
elif [[ $STVER = 4200 ]]; then
sudo sed -i 's#\x0F\xB6\x51\x05\x83\xF2\x01#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
else
sudo sed -i 's#\x80\x79\x05\x00\x0F\x94\xC2#\xC6\x41\x05\x01\xB2\x00\x90#' "$BIN_PATH"
fi
echo
success "Sublime Text installed!"
$BIN_PATH --version
echo