better detection for whether app is installed

This commit is contained in:
2020-10-27 11:32:02 +01:00
parent d7aa10602c
commit 6f21595709

View File

@@ -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 if [ ! -e config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
source config.cfg source config.cfg
# Test whether necessary applications are installed # Check dependencies
function testinst { deperrors=''
APP=$1 for depend in curl; do
if [ $(which $APP | wc -l) != 1 ]; then if ! which "$depend" >/dev/null 2>&1; then
echo "$APP does not seem to be installed. Aborting." deperrors="$depend $deperrors"
exit 1
fi fi
} done
testinst curl 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 USERDB=users.db