From 37dda79db28b85210e82b27ff47883c38a703753 Mon Sep 17 00:00:00 2001 From: bcambl Date: Sat, 30 Apr 2016 18:11:37 -0600 Subject: [PATCH] install dependencies for install script --- automated install/basic-install.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index edc9ee74..60482f8a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -72,8 +72,9 @@ if [ -x "$(command -v rpm)" ];then PKG_MANAGER="yum" fi PKG_CACHE="/var/cache/$PKG_MANAGER" - PKG_UPDATE="$PKG_MANAGER update -y" + PKG_UPDATE="$PKG_MANAGER check-update -q" PKG_INSTALL="$PKG_MANAGER install -y" + INSTALLER_DEPS=( iproute procps-ng newt ) PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd php-common php-cli php git curl unzip wget ) package_check() { rpm -qa | grep ^$1- > /dev/null @@ -84,6 +85,7 @@ elif [ -x "$(command -v apt-get)" ];then PKG_CACHE="/var/cache/apt" PKG_UPDATE="apt-get -qq update" PKG_INSTALL="apt-get -y -qq install" + INSTALLER_DEPS=( apt-utils whiptail ) PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget ) package_check() { dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed" @@ -93,6 +95,20 @@ else exit fi +echo "::: Checking installer dependencies..." +for i in "${INSTALLER_DEPS[@]}"; do + echo -n "::: Checking for $i..." + package_check $i > /dev/null + if ! [ $? -eq 0 ]; then + $SUDO $PKG_UPDATE + echo -n " Not found! Installing...." + $SUDO $PKG_INSTALL "$i" > /dev/null + echo " done!" + else + echo " already installed!" + fi +done + ####### FUNCTIONS ########## spinner() {