Revert inadvertent commits

This commit is contained in:
Dan Schaper 2016-10-09 19:41:32 -07:00 committed by GitHub
parent 293c60fb9c
commit 7e0afffca8

View file

@ -73,9 +73,9 @@ if [ -x "$(command -v apt-get)" ];then
#############################################
PKG_MANAGER="apt-get"
PKG_CACHE="/var/lib/apt/lists/"
UPDATE_PKG_CACHE="$PKG_MANAGER update"
UPDATE_PKG_CACHE="$PKG_MANAGER -qq update"
PKG_UPDATE="$PKG_MANAGER upgrade"
PKG_INSTALL="$PKG_MANAGER --yes install"
PKG_INSTALL="$PKG_MANAGER --yes --quiet install"
PKG_COUNT="$PKG_MANAGER -s -o Debug::NoLocking=true upgrade | grep -c ^Inst"
INSTALLER_DEPS=( apt-utils whiptail dhcpcd5)
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd ${phpVer}-common ${phpVer}-cgi git curl unzip wget sudo netcat cron iproute2 )
@ -83,7 +83,7 @@ if [ -x "$(command -v apt-get)" ];then
LIGHTTPD_GROUP="www-data"
LIGHTTPD_CFG="lighttpd.conf.debian"
package_check() {
dpkg-query -W -f='${Status}' "$1" | grep -c "ok installed"
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
}
elif [ -x "$(command -v rpm)" ];then
# Fedora Family
@ -582,12 +582,11 @@ stopServices() {
echo " done."
}
check_cache_freshness() {
installerDependencies() {
#Running apt-get update/upgrade with minimal output can cause some issues with
#requiring user input (e.g password for phpmyadmin see #218)
#We'll change the logic up here, to check to see if there are any updates availible and
# if so, advise the user to run apt-get update/upgrade at their own discretion
#Check to see if apt-get update has already been run today
# it needs to have been run at least once on new installs!
timestamp=$(stat -c %Y ${PKG_CACHE})
@ -613,24 +612,32 @@ check_cache_freshness() {
echo "::: We recommend you run '$PKG_UPDATE' after installing Pi-Hole! "
echo ":::"
fi
}
dependency_package_install() {
# Install and verify package installation, exit out if any errors are detected
# Takes array as argument then iterates over array
declare -a argArray1=("${!1}")
for i in "${argArray1[@]}"; do
echo ":::"
echo "::: Checking installer dependencies..."
for i in "${INSTALLER_DEPS[@]}"; do
echo -n "::: Checking for $i..."
if ! package_check ${i} &>/dev/null; then
package_check ${i} > /dev/null
if ! [ $? -eq 0 ]; then
echo -n " Not found! Installing...."
${PKG_INSTALL} "$i" > /dev/null 2>&1
if ! package_check ${i} &>/dev/null; then
echo "::: ERROR, package ${i} has not been installed, please run ${UPDATE_PKG_CACHE} and try install again."
exit 1
else
echo " done!"
else
echo " already installed!"
fi
done
}
checkForDependencies() {
# Install dependencies for Pi-Hole
echo "::: Checking Pi-Hole dependencies:"
for i in "${PIHOLE_DEPS[@]}"; do
echo -n "::: Checking for $i..."
package_check ${i} > /dev/null
if ! [ $? -eq 0 ]; then
echo -n " Not found! Installing...."
${PKG_INSTALL} "$i" > /dev/null & spinner $!
echo " done!"
else
echo " already installed!"
fi
@ -789,10 +796,7 @@ finalExports() {
installPihole() {
# Install base files and web interface
echo "Checking for Pi-hole dependencies"
if ! dependency_package_install PIHOLE_DEPS[@]; then
exit 1
fi
checkForDependencies # done
stopServices
setUser
if [ ! -d "/var/www/html" ]; then
@ -821,10 +825,7 @@ installPihole() {
updatePihole() {
# Install base files and web interface
echo "Checking for Pi-hole dependencies"
if ! dependency_package_install PIHOLE_DEPS[@]; then
exit 1
fi
checkForDependencies # done
stopServices
getGitFiles
installScripts
@ -927,14 +928,8 @@ else
verifyFreeDiskSpace
fi
# Check the package cache and update if necessary
check_cache_freshness
# Install packages used by this installation script
echo "::: Checking for installer dependencies..."
if ! dependency_package_install INSTALLER_DEPS[@]; then
exit 1
fi
installerDependencies
if [[ ${useUpdateVars} == false ]]; then
welcomeDialogs