From 6f21595709a440b1659ee90c6dd1b00c71ed4b15 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Tue, 27 Oct 2020 11:32:02 +0100 Subject: [PATCH] better detection for whether app is installed --- update.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/update.sh b/update.sh index 977ac46..154f5a3 100755 --- a/update.sh +++ b/update.sh @@ -32,15 +32,22 @@ cd "$(dirname "$(readlink -f "$0")")" if [ ! -e config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi source config.cfg -# Test whether necessary applications are installed -function testinst { - APP=$1 - if [ $(which $APP | wc -l) != 1 ]; then - echo "$APP does not seem to be installed. Aborting." - exit 1 +# Check dependencies +deperrors='' +for depend in curl; do + if ! which "$depend" >/dev/null 2>&1; then + deperrors="$depend $deperrors" fi -} -testinst curl +done +if [ -n "$deperrors" ]; then + cat <<-EOF + This program depends on some other programs to function. + Not all of those programs could be located on your system. + Please use your package manager to install the following programs: + EOF + echo "$deperrors" + exit 1 +fi USERDB=users.db