Improve download script

This commit is contained in:
crschnick 2023-05-10 00:13:49 +00:00
parent 90bc07981f
commit 2c9d26f65f

View file

@ -19,6 +19,7 @@ get_file_ending() {
;;
*)
exit 1
;;
esac
}
@ -79,6 +80,7 @@ parse_os_name() {
;;
*)
return 1
;;
esac
return 0
}
@ -87,17 +89,24 @@ uninstall() {
local uname_str="$(uname -s)"
case "$uname_str" in
Linux)
if [ -d "/opt/xpipe" ]; then
info "Uninstalling previous version"
if [ -f "/etc/debian_version" ]; then
DEBIAN_FRONTEND=noninteractive sudo apt-get remove -qy xpipe
else
sudo rpm -e xpipe
fi
fi
;;
Darwin)
if [ -d "/Applications/X-Pipe.app" ]; then
info "Uninstalling previous version"
sudo /Applications/X-Pipe.app/Contents/Resources/scripts/uninstall.sh
fi
;;
*)
exit 1
;;
esac
}
@ -118,6 +127,7 @@ install() {
;;
*)
exit 1
;;
esac
}
@ -159,16 +169,17 @@ check_architecture() {
return 1
}
# return if sourced (for testing the functions above)
return 0 2>/dev/null
check_architecture "$(uname -m)" || exit 1
download_archive="$(download_release; exit "$?")"
download_archive="$(
download_release
exit "$?"
)"
exit_status="$?"
if [ "$exit_status" != 0 ]
then
if [ "$exit_status" != 0 ]; then
error "Could not download X-Pipe release."
exit "$exit_status"
fi