Last active
March 20, 2023 08:54
-
-
Save KR1470R/98d964914b7ace57f48c0f25d2f92843 to your computer and use it in GitHub Desktop.
Update VSCodium with custom tar.gz updates.
This file contains 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 characters
#!/bin/sh | |
set -e | |
if [ -z "$1" ] || ! [ -e "$1" ]; then | |
printf "\e[31mHave nothing from update.\e[0m\n\n" | |
exit 1 | |
fi | |
DEFAULT_VSCODIUM_PATH="/usr/share/vscodium" | |
if [ -z "$2" ] || ! [ -d "$2" ]; then | |
printf "\e[34mChecking for $DEFAULT_VSCODIUM_PATH...\n\n" | |
if [ -d "$DEFAULT_VSCODIUM_PATH" ]; then | |
printf "Using $DEFAULT_VSCODIUM_PATH as target.\n\n" | |
TARGET_INSTALL_FOLDER="$DEFAULT_VSCODIUM_PATH" | |
else | |
printf "\e[31m$DEFAULT_VSCODIUM_PATH does not exitst! please enter valid path to vscode.\e[0m\n\n" | |
exit 1 | |
fi | |
else | |
TARGET_INSTALL_FOLDER="$2" | |
fi | |
TARGET_FILE="$1" | |
TARGET_FOLDER="$(dirname $TARGET_FILE)/$(basename "$TARGET_FILE" .tar.gz)" | |
if [ -d "$TARGET_FOLDER" ]; then | |
rm -rf "$TARGET_FOLDER" | |
fi | |
mkdir "$TARGET_FOLDER" | |
tar -xf "$TARGET_FILE" --directory "$TARGET_FOLDER" | |
printf "\e[34mTarget version -> %s\n\n" "$TARGET_FILE" | |
printf "Clearing up - %s\n\n" "$TARGET_INSTALL_FOLDER" | |
sudo rm -rf "${TARGET_INSTALL_FOLDER:?}/"* | |
printf "Putting all from %s into %s\n\n" "$TARGET_FOLDER" "$TARGET_INSTALL_FOLDER" | |
sudo cp -r "${TARGET_FOLDER}/"* "$TARGET_INSTALL_FOLDER" | |
printf "Covering up all tracks...\e[0m\n\n" | |
rm -rf "$TARGET_FOLDER" | |
rm "$TARGET_FILE" | |
printf "\e[32mFinished.\e[0m\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On linux every time you get a new vscodium update you should either update your vscodium through the package manager or do it yourself(downloading the update archive, extracting everything from there and moving everything into your vscodium folder). Sometimes on some distributions you have to wait longer for someone who will upload vscodium on user repository in time onto with the release itself, usually with a delay. You also have to spend a little more time for building package. Thus this util can help you to update vscodium in countable seconds.
Usage:
./vscodium-update <path to tar.gz update> <path to vscodium destination(default /usr/share/vscodium/>