adding option --edge to install latest edge / preview version (#4605)
* adding option --edge to install latest edge / preview version * updated arg --edge parsing to match the style of --dryrun
This commit is contained in:
parent
c77999bcd3
commit
18e66c4299
13
install.sh
13
install.sh
|
@ -23,7 +23,7 @@ The remote host must have internet access.
|
||||||
${not_curl_usage-}
|
${not_curl_usage-}
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
$arg0 [--dry-run] [--version X.X.X] [--method detect] \
|
$arg0 [--dry-run] [--version X.X.X] [--edge] [--method detect] \
|
||||||
[--prefix ~/.local] [--rsh ssh] [user@host]
|
[--prefix ~/.local] [--rsh ssh] [user@host]
|
||||||
|
|
||||||
--dry-run
|
--dry-run
|
||||||
|
@ -32,6 +32,9 @@ Usage:
|
||||||
--version X.X.X
|
--version X.X.X
|
||||||
Install a specific version instead of the latest.
|
Install a specific version instead of the latest.
|
||||||
|
|
||||||
|
--edge
|
||||||
|
Install the latest edge version instead of the latest stable version.
|
||||||
|
|
||||||
--method [detect | standalone]
|
--method [detect | standalone]
|
||||||
Choose the installation method. Defaults to detect.
|
Choose the installation method. Defaults to detect.
|
||||||
- detect detects the system package manager and tries to use it.
|
- detect detects the system package manager and tries to use it.
|
||||||
|
@ -71,8 +74,12 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_latest_version() {
|
echo_latest_version() {
|
||||||
|
if [ "${EDGE-}" ]; then
|
||||||
|
version="$(curl -fsSL https://api.github.com/repos/cdr/code-server/releases | awk 'match($0,/.*"html_url": "(.*\/releases\/tag\/.*)".*/)' | head -n 1 | awk -F '"' '{print $4}')"
|
||||||
|
else
|
||||||
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
|
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
|
||||||
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
|
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
|
||||||
|
fi
|
||||||
version="${version#https://github.com/cdr/code-server/releases/tag/}"
|
version="${version#https://github.com/cdr/code-server/releases/tag/}"
|
||||||
version="${version#v}"
|
version="${version#v}"
|
||||||
echo "$version"
|
echo "$version"
|
||||||
|
@ -135,6 +142,7 @@ main() {
|
||||||
OPTIONAL \
|
OPTIONAL \
|
||||||
ALL_FLAGS \
|
ALL_FLAGS \
|
||||||
RSH_ARGS \
|
RSH_ARGS \
|
||||||
|
EDGE \
|
||||||
RSH
|
RSH
|
||||||
|
|
||||||
ALL_FLAGS=""
|
ALL_FLAGS=""
|
||||||
|
@ -170,6 +178,9 @@ main() {
|
||||||
--version=*)
|
--version=*)
|
||||||
VERSION="$(parse_arg "$@")"
|
VERSION="$(parse_arg "$@")"
|
||||||
;;
|
;;
|
||||||
|
--edge)
|
||||||
|
EDGE=1
|
||||||
|
;;
|
||||||
--rsh)
|
--rsh)
|
||||||
RSH="$(parse_arg "$@")"
|
RSH="$(parse_arg "$@")"
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in New Issue