Last active
May 19, 2020 12:46
-
-
Save ledakis/790a01c7e2b6c00a2d472c824a8eeec4 to your computer and use it in GitHub Desktop.
I have set up my own code-server (https://github.com/cdr/code-server) and the auto update fails, so here is a script to pull the latest x64 release and install it.
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
#!/usr/bin/env bash | |
set -e | |
INSTALL_DIR="/usr/lib/code-server/" | |
echo Install dir: $INSTALL_DIR | |
temp_dir=$(mktemp -d) | |
old_dir=$(pwd) | |
cd $temp_dir | |
curl -L --output code-server.tar.gz $(curl -s https://api.github.com/repos/cdr/code-server/releases/latest | jq -r '.assets[] | select(.name|contains("linux-amd64"))| .browser_download_url') | |
tar xzf code-server.tar.gz -C $INSTALL_DIR --strip-components=1 | |
echo Updated, new version: | |
code-server --version | |
cd $old_dir | |
echo "Done" |
Works like that. Maybe the curl could have been silent 🤷♂️
bash update_code.sh
Install dir: /usr/lib/code-server/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 650 100 650 0 0 2249 0 --:--:-- --:--:-- --:--:-- 2249
100 66.0M 100 66.0M 0 0 19.1M 0 0:00:03 0:00:03 --:--:-- 21.5M
Updated, new version:
3.2.0 fd36a99a4c78669970ebc4eb05768293b657716f
Done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires the
INSTALL_DIR
to exist, andjq
installed.