dotfiles/playbooks/roles/vscode/templates/update.sh.j2

32 lines
933 B
Text
Raw Normal View History

#!/bin/bash
# for upstream
URL='https://code.visualstudio.com/sha/download?build=insider&os=linux-x64'
# for local
# URL='https://maxwell.mfocko.xyz/code-insiders.tar.gz'
# for local over VPN (also use --no-check-certificate)
# URL='https://172.16.0.2/code-insiders.tar.gz'
echo ">>> Downloading";
wget $URL -O /tmp/code.tar.gz
echo ">>> Removing and extracting";
rm -rf /opt/VSCode-linux-x64
tar xvaf /tmp/code.tar.gz -C /opt/
# Check for binaries
if ! [ -x /usr/local/bin/code-insiders ]; then
echo ">>> Linking binaries";
ln -s /opt/VSCode-linux-x64/bin/code-insiders /usr/local/bin/
ln -s /opt/VSCode-linux-x64/bin/code-insiders /usr/local/bin/code
fi
# Check for *.desktop
if ! ls /usr/share/applications | grep visual-studio-code; then
echo ">>> Installing desktop files";
PATH_TO_APPS=/home/mfocko/.local/share/visual-studio-code-insiders
sudo cp $PATH_TO_APPS{,-url-handler}.desktop /usr/share/applications/;
fi