#!/usr/bin/env bash # The goal is : # -> to create a folder ".vscodium_scripts" # at $HOME who have this script and the .AppImage # # -> to create some shortcut "code" for codium # and "updateCodium" to relaunch this script # and update codium # kill codium if already running if pgrep -f "codium" > /dev/null then pkill -9 codium fi if [ -x $HOME/.vscodium_scripts ] ; then # if the folder already exists (not the first run?) # remove the folder rm -r $HOME/.vscodium_scripts else # if the folder isn't already created (first run?) #echo "First run, adding commmands to shell, you will need to restart your shell" #echo "to use theses commands : \"code\" for Codium and \"updateCodium\" to update it." # adding code command and updateCodium command # to all the shell installed # to .bashrc if exists if [ -f $HOME/.bashrc ] ; then echo "alias updateCodium='$HOME/.vscodium_scripts/downloadVSCodium.sh'" >> $HOME/.bashrc echo "alias code='$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox'" >> $HOME/.bashrc fi # to .zshrc if exists if [ -f $HOME/.zshrc ] ; then echo "alias updateCodium='$HOME/.vscodium_scripts/downloadVSCodium.sh'" >> $HOME/.zshrc echo "alias code='$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox'" >> $HOME/.zshrc fi # to config.fish if exists if [ -f $HOME/.config/fish/config.fish ] ; then echo "abbr updateCodium '$HOME/.vscodium_scripts/downloadVSCodium.sh'" >> $HOME/.config/fish/config.fish echo "abbr code '$HOME/.vscodium_scripts/VSCodium.AppImage --no-sandbox'" >> $HOME/.config/fish/config.fish fi fi # (re)creating the folder mkdir $HOME/.vscodium_scripts cd $HOME/.vscodium_scripts # downloading this script in the folder wget -q --show-progress https://git.kennel.ml/Anri/downloadcodium/raw/branch/main/updateVSCodium.sh # retrieve latest vscodium package url wget -q https://api.github.com/repos/VSCodium/vscodium/releases/latest grep 'browser_download_url": ".*.AppImage"' latest | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }' > url rm latest # download the latest vscodium AppImage wget -q --show-progress -i url -O VSCodium.AppImage rm url # make it executable chmod u+x VSCodium.AppImage echo "" # not really installed because no packet manager know what happened echo "VSCodium is now downloaded and \"installed*\" at $PWD/VSCodium.AppImage." echo "You need to restart your shell to use all the new commands." echo "`updateCodium` -> update Codium to the latest version" echo "`code` -> start Codium"