Skip to content
Snippets Groups Projects
Verified Commit 81b78e7a authored by orestis.malaspin's avatar orestis.malaspin
Browse files

added creation of /home/orestis/.local/bin directory if not existing

parent 9af0a3ae
No related branches found
No related tags found
1 merge request!1Adds creation of $HOME/.local/bin directory if not existing
......@@ -3,13 +3,18 @@
#
# Distributed under terms of the GPLv3 license.
{ \unalias command; \unset -f command; } >/dev/null 2>&1
{
\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"
printf "The dojo is installed in %s\nMake sure %s is in your path\n" "$dest" "$destdir"
printf "If you are using bash you may want to append:\n"
printf "export PATH=\"\$PATH:%s\" to your .bashrc file.\n" "$destdir"
cleanup
}
......@@ -23,8 +28,8 @@ cleanup() {
die() {
cleanup
printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr;
exit 1;
printf "\033[31m%s\033[m\n\r" "$*" >/dev/stderr
exit 1
}
detect_jq_tool() {
......@@ -37,7 +42,6 @@ detect_jq_tool() {
fi
}
detect_network_tool() {
if command -v curl 2>/dev/null >/dev/null; then
fetch() {
......@@ -72,11 +76,11 @@ detect_network_tool() {
fi
}
detect_os() {
arch=""
case "$(command uname)" in
'Darwin') OS="macos"
'Darwin')
OS="macos"
case "$(command uname -m)" in
amd64 | x86_64) arch="x64" ;;
aarch64*) arch="arm64" ;;
......@@ -95,7 +99,7 @@ detect_os() {
*) 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_url to download manually"
*) die "dojo binaries are not available for $(command uname). See $gitedu_url to download manually" ;;
esac
}
......@@ -106,23 +110,26 @@ expand_tilde() {
}
parse_args() {
dest='~/.local/bin'
[ "$OS" = "macos" ] && dest="/usr/local/bin"
destdir='~/.local/bin'
[ "$OS" = "macos" ] && destdir="/usr/local/bin"
installer=''
while :; do
case "$1" in
dest=*) dest="${1#*=}";;
destdir=*) destdir="${1#*=}" ;;
installer=*) installer="${1#*=}" ;;
"") break ;;
*) die "Unrecognized command line option: $1" ;;
esac
shift
done
dest=$(expand_tilde "${dest}")
dest="$dest/dojo"
destdir=$(expand_tilde "${destdir}")
if [ ! -d "$destdir" ]; then
printf "Directory %s does not exist. Creatring %s now.\n" "$destdir" "$destdir"
mkdir -p "$destdir"
fi
dest="$destdir/dojo"
}
get_file_url() {
url="https://gitedu.hesge.ch/api/v4/projects/12972/packages/generic/dojo"
if [ "$OS" = "macos" ]; then
......@@ -138,7 +145,6 @@ get_release_url() {
get_file_url "$release_version"
}
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment