Skip to content
Snippets Groups Projects
Commit 9af0a3ae authored by michael.minelli's avatar michael.minelli
Browse files

Add pre-alpha installer and change method to get latest release

parent 2ef86d48
Branches
No related tags found
No related merge requests found
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
{ \unalias command; \unset -f command; } >/dev/null 2>&1 { \unalias command; \unset -f command; } >/dev/null 2>&1
tdir='' tdir=''
gitedu_release_url="https://gitedu.hesge.ch/dojo_project/projects/ui/dojocli/-/releases/Latest" 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() { cleanup_success() {
printf "The dojo is installed in %s\nMake sure %s is in your path\n" "$dest" "$dest" printf "The dojo is installed in %s\nMake sure %s is in your path\n" "$dest" "$dest"
cleanup cleanup
...@@ -28,7 +30,7 @@ die() { ...@@ -28,7 +30,7 @@ die() {
detect_jq_tool() { detect_jq_tool() {
if command -v jq 2> /dev/null > /dev/null; then if command -v jq 2> /dev/null > /dev/null; then
get_version() { get_version() {
command jq -r '.["version"]' command jq -r '."assets"."links"[0].url' | command awk -F '/' '{print $(NF-1)}'
} }
else else
die "jq not available on your system cannot get dojo version" die "jq not available on your system cannot get dojo version"
...@@ -66,7 +68,7 @@ detect_network_tool() { ...@@ -66,7 +68,7 @@ detect_network_tool() {
command wget --quiet -O- "$1" | get_version command wget --quiet -O- "$1" | get_version
} }
else 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 fi
} }
...@@ -80,7 +82,7 @@ detect_os() { ...@@ -80,7 +82,7 @@ detect_os() {
aarch64*) arch="arm64";; aarch64*) arch="arm64";;
armv8*) arch="arm64";; armv8*) arch="arm64";;
arm64) 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 esac
;; ;;
'Linux') 'Linux')
...@@ -90,10 +92,10 @@ detect_os() { ...@@ -90,10 +92,10 @@ detect_os() {
aarch64*) arch="arm64";; aarch64*) arch="arm64";;
armv8*) arch="arm64";; armv8*) arch="arm64";;
arm64) 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 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 esac
} }
...@@ -131,20 +133,22 @@ get_file_url() { ...@@ -131,20 +133,22 @@ get_file_url() {
} }
get_release_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" [ $? -ne 0 -o -z "$release_version" ] && die "Could not get dojo latest release version"
get_file_url "$release_version" get_file_url "$release_version"
} }
get_nightly_url() { get_prealpha_url() {
die "Error nightly not available yet" gitedu_url=$gitedu_prealpha_url
# get_file_url "nightly" # TODO: fix for nightly 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() { get_download_url() {
case "$installer" in case "$installer" in
"nightly") get_nightly_url ;; # TODO: add nightly capabilities "pre-alpha") get_prealpha_url ;;
"") get_release_url ;; "") get_release_url ;;
*) ;; *) ;;
esac esac
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment