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 master
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment