diff --git a/contrib/install.sh b/contrib/install.sh index 4d90aa736d..739d49ece0 100755 --- a/contrib/install.sh +++ b/contrib/install.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# This script was generated by bashly 0.9.4 (https://bashly.dannyb.co) +# This script was generated by bashly 1.1.1 (https://bashly.dannyb.co) # Modifying it manually is not recommended if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then @@ -120,10 +120,10 @@ root_command() { fi echo "### Getting and adding key" - wget -qO- https://dl.packager.io/srv/$publisher/InvenTree/key | sudo apt-key add - + curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg> /dev/null echo "### Adding package source" - do_call "sudo wget -O /etc/apt/sources.list.d/inventree.list https://dl.packager.io/srv/$publisher/InvenTree/$source_url/installer/$DIST_OS/$DIST_VER.repo" - + SOURCE_URL="deb [signed-by=/etc/apt/trusted.gpg.d/pkgr-inventree.gpg] https://dl.packager.io/srv/deb/$publisher/InvenTree/$source_url/$DIST_OS $DIST_VER main" + echo "$SOURCE_URL" | tee /etc/apt/sources.list.d/inventree.list > /dev/null echo "### Updating package lists" do_call "sudo apt-get update" @@ -164,13 +164,6 @@ install.sh_usage() { if [[ -n $long_usage ]]; then printf "%s\n" "Options:" - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - printf " %s\n" "--version, -v" - printf " Show version number\n" - echo - printf " %s\n" "--no-call, -n" printf " Do not call outside APIs (only functionally needed)\n" echo @@ -179,6 +172,13 @@ install.sh_usage() { printf " Dry run (do not install anything)\n" echo + printf " %s\n" "--help, -h" + printf " Show this help\n" + echo + printf " %s\n" "--version, -v" + printf " Show version number\n" + echo + printf "%s\n" "Arguments:" printf " %s\n" "SOURCE" @@ -226,8 +226,8 @@ normalize_input() { } inspect_args() { - readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) if ((${#args[@]})); then + readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) echo args: for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done else @@ -242,6 +242,14 @@ inspect_args() { echo "- \${other_args[$i]} = ${other_args[$i]}" done fi + + if ((${#deps[@]})); then + readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) + echo + echo deps: + for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done + fi + } parse_requirements() { @@ -312,7 +320,7 @@ parse_requirements() { [[ -n ${args['source']:-} ]] || args['source']="stable" [[ -n ${args['publisher']:-} ]] || args['publisher']="inventree" - if [[ ! ${args['source']} =~ ^(stable|master|main)$ ]]; then + if [[ -n ${args['source']} ]] && [[ ! ${args['source']} =~ ^(stable|master|main)$ ]]; then printf "%s\n" "source must be one of: stable, master, main" >&2 exit 1 fi @@ -329,16 +337,14 @@ initialize() { run() { declare -A args=() + declare -A deps=() declare -a other_args=() declare -a input=() normalize_input "$@" parse_requirements "${input[@]}" case "$action" in - "root") - root_command - ;; - + "root") root_command ;; esac } diff --git a/contrib/installer/src/root_command.sh b/contrib/installer/src/root_command.sh index 54c0c52ec3..b9c7b9a8d7 100644 --- a/contrib/installer/src/root_command.sh +++ b/contrib/installer/src/root_command.sh @@ -110,10 +110,10 @@ if [[ $NEEDS_LIBSSL1_1 == "true" ]]; then fi echo "### Getting and adding key" -wget -qO- https://dl.packager.io/srv/$publisher/InvenTree/key | sudo apt-key add - +curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg> /dev/null echo "### Adding package source" -do_call "sudo wget -O /etc/apt/sources.list.d/inventree.list https://dl.packager.io/srv/$publisher/InvenTree/$source_url/installer/$DIST_OS/$DIST_VER.repo" - +SOURCE_URL="deb [signed-by=/etc/apt/trusted.gpg.d/pkgr-inventree.gpg] https://dl.packager.io/srv/deb/$publisher/InvenTree/$source_url/$DIST_OS $DIST_VER main" +echo "$SOURCE_URL" | tee /etc/apt/sources.list.d/inventree.list > /dev/null echo "### Updating package lists" do_call "sudo apt-get update"