From 852341c601fba5571246f03d7b36de185d7a4c1b Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 21 Dec 2016 22:57:42 -0800 Subject: [PATCH] Check for installation status within the parent function. Signed-off-by: Dan Schaper --- automated install/basic-install.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9e6383ee..cc7d04dd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -97,10 +97,6 @@ if [[ $(command -v apt-get) ]]; then LIGHTTPD_CFG="lighttpd.conf.debian" DNSMASQ_USER="dnsmasq" - package_check() { - dpkg-query -W -f='${Status}' "${1}" 2>/dev/null | grep "ok installed" - return - } elif [ $(command -v rpm) ]; then # Fedora Family if [ $(command -v dnf) ]; then @@ -116,8 +112,7 @@ elif [ $(command -v rpm) ]; then PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget) if grep -q 'Fedora' /etc/redhat-release; then - remove_deps=(epel-release); - PIHOLE_DEPS=( ${PIHOLE_DEPS[@]/$remove_deps} ); + PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release}); fi LIGHTTPD_USER="lighttpd" LIGHTTPD_GROUP="lighttpd" @@ -756,7 +751,7 @@ install_dependent_packages() { if command -v debconf-apt-progress &> /dev/null; then for i in "${argArray1[@]}"; do echo -n "::: Checking for $i..." - if package_check "${i}" &> /dev/null; then + if dpkg-query -W -f='${Status}' "${i}" 2>/dev/null | grep "ok installed" &> /dev/null; then echo " installed!" else echo " added to install list!"