From a8502492740a1e45cd9e375142468faa679d98fa Mon Sep 17 00:00:00 2001 From: Dan Johansen Date: Mon, 2 Dec 2019 21:38:19 +0100 Subject: [PATCH] another attempt at fixing dependency checking, hopefully fixed #9 now --- manjaro-arm-installer | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/manjaro-arm-installer b/manjaro-arm-installer index 1a68754..b1754bc 100755 --- a/manjaro-arm-installer +++ b/manjaro-arm-installer @@ -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