From 0f805a31db48d5fa56f53bb6f7da5efd81b70992 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Thu, 8 Aug 2024 10:35:43 +0100 Subject: [PATCH] JAL-3631 Better messaging and a root check on updating the --installation --- utils/getdown/bin/update.sh | 9 +++++++++ utils/install4j/macos-install-jalview.sh | 2 ++ 2 files changed, 11 insertions(+) diff --git a/utils/getdown/bin/update.sh b/utils/getdown/bin/update.sh index 28755aa..03f369e 100755 --- a/utils/getdown/bin/update.sh +++ b/utils/getdown/bin/update.sh @@ -12,6 +12,7 @@ USAGE="Please use either --installation or --userspace" DEBUG=0 USERSPACE=0 INSTALLATION=0 +DISABLEROOTCHECK=0 for RAWARG in "${@}"; do ARG="${RAWARG%%=*}" case "${ARG}" in @@ -24,6 +25,9 @@ for RAWARG in "${@}"; do --userspace) USERSPACE=1 ;; + --norootcheck) + DISABLEROOTCHECK=1 + ;; *) echo "Unknown option '${ARG}'. ${USAGE}." >&2 exit 2 @@ -160,6 +164,11 @@ fi # INSTALLATION update if [ "${INSTALLATION}" = 1 ]; then + # root permissions check + if [ "${DISABLEROOTCHECK}" != 1 -a "${EUID}" != 0 ]; then + echo "--installation updates should be run with root permissions, or disable this root check with --norootcheck" >&2 + exit 6 + fi JVMARGS=( "${JVMARGS[@]}" "-Duserdefaultappdir=false" ) JVMARGS=( "${JVMARGS[@]}" "-Dnouserdefaultappdir=true" ) JVMARGS=( "${JVMARGS[@]}" "-Dlauncher.appdir=${APPDIR}" ) diff --git a/utils/install4j/macos-install-jalview.sh b/utils/install4j/macos-install-jalview.sh index 664ba90..aa9f0fd 100755 --- a/utils/install4j/macos-install-jalview.sh +++ b/utils/install4j/macos-install-jalview.sh @@ -133,6 +133,8 @@ myecho() { # no -d or -i arguments if [ "${DOWNLOAD}" = 0 -a -z "${DMGFILE}" ]; then + echo "Please use one of -d or -i options" + echo "" usage exit 0 fi -- 1.7.10.2