From 59c592dc7e04fc09db48f9f61467290a75573cfc Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 17 Aug 2023 03:31:20 +0000 Subject: [PATCH] Fix arch handling of installation script --- get-xpipe.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/get-xpipe.sh b/get-xpipe.sh index 5084010e1..a597f7b12 100755 --- a/get-xpipe.sh +++ b/get-xpipe.sh @@ -34,9 +34,9 @@ download_release_from_repo() { local tmpdir="$2" local repo="$3" local version="$4" + local arch="$5" local ending=$(get_file_ending) - local arch="$(uname -m)" local release_url=$(release_url "$repo" "$version") local filename="xpipe-installer-$os_info-$arch.$ending" @@ -158,34 +158,39 @@ download_release() { local download_dir="$(mktemp -d)" local repo="$1" local version="$2" - download_release_from_repo "$os_info" "$download_dir" "$repo" "$version" + download_release_from_repo "$os_info" "$download_dir" "$repo" "$version" "$arch" } check_architecture() { - local arch="$1" + local arch="$(uname -m)" case "$arch" in x86_64) - return 0 + echo x86_64 ;; amd64) - return 0 + echo x86_64 ;; arm64) - return 0 + echo arm64 ;; aarch64) - return 0 + echo arm64 + ;; + *) + exit 1 ;; esac - - error "Sorry! XPipe currently does not provide your processor architecture." - return 1 } # return if sourced (for testing the functions above) return 0 2>/dev/null -check_architecture "$(uname -m)" || exit 1 +arch=$(check_architecture) +exit_status="$?" +if [ "$exit_status" != 0 ]; then + error "Sorry! XPipe currently does not support your processor architecture." + exit "$exit_status" +fi repo="https://github.com/xpipe-io/xpipe" version= @@ -227,7 +232,7 @@ if ! [ -x "$(command -v apt)" ] && ! [ -x "$(command -v rpm)" ] && ! [ -x "$(com fi download_archive="$( - download_release "$repo" "$version" + download_release "$repo" "$version" "$arch" exit "$?" )" exit_status="$?" @@ -239,6 +244,12 @@ fi uninstall install "$download_archive" +exit_status="$?" +if [ "$exit_status" != 0 ]; then + error "Installation failed." + exit "$exit_status" +fi + printf "XPipe was successfully installed. You should be able to find XPipe in your desktop environment now. The " bold "xpipe" printf " cli executable was also added to your path. You can ether use "