another attempt at fixing dependency checking, hopefully fixed #9 now

This commit is contained in:
Dan Johansen 2019-12-02 21:38:19 +01:00
parent 101e92ceff
commit a850249274
1 changed files with 8 additions and 24 deletions

View File

@ -41,31 +41,15 @@ if [ "$EUID" -ne 0 ]; then
fi
# Sanity checks for dependencies
if [ ! -f /usr/bin/git || ! -f /usr/sbin/git || ! -f /sbin/git || ! -f /bin/git ]; then
echo "git command is missing! Please install git!"
declare -a DEPENDNECIES=("git" "parted" "systemd-nspawn" "wget" "dialog" "bsdtar" "openssl" "awk")
for i in "${DEPENDNECIES[@]}"; do
if ! [[ -f "/bin/$i" || -f "/sbin/$i" || -f "/usr/bin/$i" || -f "/usr/sbin/$i" ]] ; then
echo "$i command is missing! Please install the relevant package."
exit 1
elif [ ! -f /usr/bin/parted || ! -f /usr/sbin/parted || ! -f /sbin/parted || ! -f /bin/parted ]; then
echo "parted command is missing! Please install parted!"
exit 1
elif [ ! -f /usr/bin/systemd-nspawn || ! -f /usr/sbin/systemd-nspawn || ! -f /sbin/systemd-nspawn || ! -f /bin/systemd-nspawn ]; then
echo "systemd-nspawn command is missing! Please install systemd!"
exit 1
elif [ ! -f /usr/bin/wget || ! -f /usr/sbin/wget || ! -f /sbin/wget || ! -f /bin/wget ]; then
echo "wget command is missing! Please install wget!"
exit 1
elif [ ! -f /usr/bin/dialog || ! -f /usr/sbin/dialog || ! -f /sbin/dialog || ! -f /bin/dialog ]; then
echo "dialog command is missing! Please install dialog!"
exit 1
elif [ ! -f /usr/bin/bsdtar || ! -f /usr/sbin/bsdtar || ! -f /sbin/bsdtar || ! -f /bin/bsdtar ]; then
echo "bsdtar command is missing! Please install libarchive!"
exit 1
elif [ ! -f /usr/bin/openssl || ! -f /usr/sbin/openssl || ! -f /sbin/openssl || ! -f /bin/openssl ]; then
echo "openssl command is missing! Please install openssl!"
exit 1
elif [ ! -f /usr/bin/awk || ! -f /usr/sbin/awk || ! -f /sbin/awk || ! -f /bin/awk ]; then
echo "awk command is missing! Please install gawk!"
exit 1
fi
fi
done
# Functions