Last active
November 8, 2019 04:01
Revisions
-
cyfrost renamed this gist
Oct 14, 2019 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,18 @@ #!/bin/bash # This script will check if VSCodium is installed in your machine, if yes, then tries to update it to the latest version # else, installs whichever the latest version is. # # NOTE: There's already this repo (https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo) that provides # the codium package for RPM based distros but for some reason the download was extremely slow. # This script pulls the download from github directly (which is hopefully a tad bit faster). # Thanks to https://stackoverflow.com/a/4024263/2631023 function verlte() { [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] } # Thanks to https://stackoverflow.com/a/4024263/2631023 function verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } @@ -26,13 +24,13 @@ function install_or_update_latest_codium() { LATEST_VERSION="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')" && \ verlt "$INSTALLED_VERSION" "$LATEST_VERSION" && IS_UPDATE_AVAILABLE="yes" || IS_UPDATE_AVAILABLE="no" if [ "$IS_UPDATE_AVAILABLE" = "yes" ] || [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ]; then [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ] && MSG="Downloading and installing latest VSCodium v$LATEST_VERSION..." || MSG="Updating VSCodium from $INSTALLED_VERSION to $LATEST_VERSION..." printf "\n$MSG\n\n" RPM_DOWNLOAD="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep "https.*x86_64.rpm" | head -1 | cut -d '"' -f 4)" FILENAME="/tmp/vscodium.rpm" [ -f $FILENAME ] && rm -f $FILENAME wget -O $FILENAME $RPM_DOWNLOAD -q --show-progress sudo dnf install -y "$FILENAME" && rm -f $FILENAME; printf "\nFinished\n\n" || printf "\nError: failed to install VSCodium version $LATEST_VERSION.\n\n" else printf "\nVSCodium is already up-to-date (Installed: "$INSTALLED_VERSION", Latest: "$LATEST_VERSION").\n\n" fi -
cyfrost revised this gist
Oct 11, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ function install_or_update_latest_codium() { LATEST_VERSION="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')" && \ verlt "$INSTALLED_VERSION" "$LATEST_VERSION" && IS_UPDATE_AVAILABLE="yes" || IS_UPDATE_AVAILABLE="no" if [ "$IS_UPDATE_AVAILABLE" = "yes" ] || [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ]; then [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ] && MSG="Downloading and installing latest VSCodium (version: $LATEST_VERSION)..." || MSG="Updating VSCodium from $INSTALLED_VERSION to $LATEST_VERSION..." printf "\n$MSG\n\n" RPM_DOWNLOAD="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep "https.*x86_64.rpm" | head -1 | cut -d '"' -f 4)" FILENAME="/tmp/vsodium.rpm" -
cyfrost created this gist
Oct 8, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/bin/bash # [TESTED ON FEDORA ONLY] # # This script will check if VSCodium is installed in your machine, if yes, then tries to update it to the latest version # else, installs whichever the latest version is. # # NOTE: There's already this repo (https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo) that provides # the codium package for RPM based distros but for some reason the download was extremely slow. # This script pulls the download from github directly (which is hopefully a tad bit faster). # Thanks to author of [this answer](https://stackoverflow.com/a/4024263/2631023) function verlte() { [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] } # Thanks to author of [this answer](https://stackoverflow.com/a/4024263/2631023) function verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 } # Checks if Codium is installed, if yes, tries to update it to latest version, else installs latest version. function install_or_update_latest_codium() { rpm -q codium | grep -q "not installed" && INSTALLED_VERSION="NOT_INSTALLED" || INSTALLED_VERSION="$(rpm -q --queryformat "%{VERSION}" codium)" LATEST_VERSION="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')" && \ verlt "$INSTALLED_VERSION" "$LATEST_VERSION" && IS_UPDATE_AVAILABLE="yes" || IS_UPDATE_AVAILABLE="no" if [ "$IS_UPDATE_AVAILABLE" = "yes" ] || [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ]; then [ "$INSTALLED_VERSION" = "NOT_INSTALLED" ] && MSG="Downloading and installing latest VSCodium (version: $LATEST_VERSION)..." || MSG "Updating VSCodium from $INSTALLED_VERSION to $LATEST_VERSION..." printf "\n$MSG\n\n" RPM_DOWNLOAD="$(curl -sL https://api.github.com/repos/vscodium/vscodium/releases/latest | grep "https.*x86_64.rpm" | head -1 | cut -d '"' -f 4)" FILENAME="/tmp/vsodium.rpm" [ -f $FILENAME ] && rm -f $FILENAME wget -O $FILENAME $RPM_DOWNLOAD -q --show-progress sudo dnf install -y "$FILENAME" && rm -f $FILENAME || printf "\nError: failed to install VSCodium version $LATEST_VERSION.\n\n" else printf "\nVSCodium is already up-to-date (Installed: "$INSTALLED_VERSION", Latest: "$LATEST_VERSION").\n\n" fi } install_or_update_latest_codium