better detection for whether app is installed
This commit is contained in:
21
update.sh
21
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."
|
||||
# Check dependencies
|
||||
deperrors=''
|
||||
for depend in curl; do
|
||||
if ! which "$depend" >/dev/null 2>&1; then
|
||||
deperrors="$depend $deperrors"
|
||||
fi
|
||||
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
|
||||
}
|
||||
testinst curl
|
||||
|
||||
USERDB=users.db
|
||||
|
||||
|
||||
Reference in New Issue
Block a user