Skip to content

Instantly share code, notes, and snippets.

@adityatelange
Last active November 6, 2022 06:02
Show Gist options
  • Save adityatelange/bafb0418f0015d84d8cfc5a83a7fedd4 to your computer and use it in GitHub Desktop.
Save adityatelange/bafb0418f0015d84d8cfc5a83a7fedd4 to your computer and use it in GitHub Desktop.
Update VSCodium on Ubuntu / Deb amd64
#!/bin/bash
urls=$(wget -O- -q https://api.github.com/repos/VSCodium/vscodium/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "amd64")
# urls=$(wget -O- -q --header="Authorization: token xyzABC" https://api.github.com/repos/VSCodium/vscodium/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "amd64")
IFS=', ' read -r -a array <<< $urls
name=$(echo $array | cut -d '/' -f 9)
version=$(echo $name | cut -d "_" -f 2 | cut -d "-" -f 1)
IFS='.' read -a sarray <<< $version
version=$(echo ${sarray[0]}.${sarray[1]}.${sarray[2]})
installed_ver=$(codium -v --no-sandbox --user-data-dir /tmp/v | cut -d$'\n' -f1)
if [ "$version" != "$installed_ver" ] && [ ! -f $name ]; then
cd /tmp/
if [ ! -f $name.sha256 ] || [ ! -f $name ]; then
wget -q -O "${name}" "${array}" --show-progress
wget -q -O "${name}.sha256" "${array}.sha256" --show-progress
if sha256sum --check $name.sha256 ;then
sudo dpkg -i $name
fi
else
if sha256sum --check $name.sha256 ;then
sudo dpkg -i $name
fi
fi
else
echo "VScodium is Up-to-Date (¬_¬)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment