diff --git a/installer.sh b/installer.sh index 93859f4149b9ec45c2df56d53368a1152e1787fe..f4b89e7d4e97e472f8a1152fcfa39afd4167a5ae 100644 --- a/installer.sh +++ b/installer.sh @@ -6,6 +6,8 @@ { \unalias command; \unset -f command; } >/dev/null 2>&1 tdir='' gitedu_release_url="https://gitedu.hesge.ch/dojo_project/projects/ui/dojocli/-/releases/Latest" +gitedu_prealpha_url="https://gitedu.hesge.ch/dojo_project/projects/ui/dojocli/-/releases/Latest" +gitedu_url=$gitedu_release_url cleanup_success() { printf "The dojo is installed in %s\nMake sure %s is in your path\n" "$dest" "$dest" cleanup @@ -28,7 +30,7 @@ die() { detect_jq_tool() { if command -v jq 2> /dev/null > /dev/null; then get_version() { - command jq -r '.["version"]' + command jq -r '."assets"."links"[0].url' | command awk -F '/' '{print $(NF-1)}' } else die "jq not available on your system cannot get dojo version" @@ -66,7 +68,7 @@ detect_network_tool() { command wget --quiet -O- "$1" | get_version } else - die "Neither curl nor wget available. Cannot download dojo. Install any of the or see $gitedu_release_url to download manually" + die "Neither curl nor wget available. Cannot download dojo. Install any of the or see $gitedu_url to download manually" fi } @@ -80,7 +82,7 @@ detect_os() { aarch64*) arch="arm64";; armv8*) arch="arm64";; arm64) arch="arm64";; - *) die "dojo binaries are not available for $(command uname -m) architecture. See $gitedu_release_url to download manually";; + *) die "dojo binaries are not available for $(command uname -m) architecture. See $gitedu_url to download manually";; esac ;; 'Linux') @@ -90,10 +92,10 @@ detect_os() { aarch64*) arch="arm64";; armv8*) arch="arm64";; arm64) arch="arm64";; - *) die "dojo binaries are not available for $(command uname -m) architecture. See $gitedu_release_url to download manually";; + *) die "dojo binaries are not available for $(command uname -m) architecture. See $gitedu_url to download manually";; esac ;; - *) die "dojo binaries are not available for $(command uname). See $gitedu_release_url to download manually" + *) die "dojo binaries are not available for $(command uname). See $gitedu_url to download manually" esac } @@ -131,20 +133,22 @@ get_file_url() { } get_release_url() { - release_version=$(fetch_and_get_version_quiet https://gitedu.hesge.ch/dojo_project/projects/ui/dojocli/-/raw/main/NodeApp/package.json) + release_version=$(fetch_and_get_version_quiet https://gitedu.hesge.ch/api/v4/projects/12972/releases/Latest) [ $? -ne 0 -o -z "$release_version" ] && die "Could not get dojo latest release version" get_file_url "$release_version" } -get_nightly_url() { - die "Error nightly not available yet" - # get_file_url "nightly" # TODO: fix for nightly +get_prealpha_url() { + gitedu_url=$gitedu_prealpha_url + prealpha_version=$(fetch_and_get_version_quiet https://gitedu.hesge.ch/api/v4/projects/12972/releases/Pre-alpha) + [ $? -ne 0 -o -z "$prealpha_version" ] && die "Could not get dojo pre-alpha release version" + get_file_url "$prealpha_version" } get_download_url() { case "$installer" in - "nightly") get_nightly_url ;; # TODO: add nightly capabilities + "pre-alpha") get_prealpha_url ;; "") get_release_url ;; *) ;; esac