1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

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_MANAGER="apt-get"
PKG_CACHE="/var/lib/apt/lists/" 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_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" PKG_COUNT="$PKG_MANAGER -s -o Debug::NoLocking=true upgrade | grep -c ^Inst"
INSTALLER_DEPS=( apt-utils whiptail dhcpcd5) INSTALLER_DEPS=( apt-utils whiptail dhcpcd5)
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd ${phpVer}-common ${phpVer}-cgi git curl unzip wget sudo netcat cron iproute2 ) 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_GROUP="www-data"
LIGHTTPD_CFG="lighttpd.conf.debian" LIGHTTPD_CFG="lighttpd.conf.debian"
package_check() { 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 elif [ -x "$(command -v rpm)" ];then
# Fedora Family # Fedora Family
@ -582,12 +582,11 @@ stopServices() {
echo " done." echo " done."
} }
check_cache_freshness() { installerDependencies() {
#Running apt-get update/upgrade with minimal output can cause some issues with #Running apt-get update/upgrade with minimal output can cause some issues with
#requiring user input (e.g password for phpmyadmin see #218) #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 #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 # 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 #Check to see if apt-get update has already been run today
# it needs to have been run at least once on new installs! # it needs to have been run at least once on new installs!
timestamp=$(stat -c %Y ${PKG_CACHE}) timestamp=$(stat -c %Y ${PKG_CACHE})
@ -613,30 +612,38 @@ check_cache_freshness() {
echo "::: We recommend you run '$PKG_UPDATE' after installing Pi-Hole! " echo "::: We recommend you run '$PKG_UPDATE' after installing Pi-Hole! "
echo ":::" echo ":::"
fi fi
} echo ":::"
echo "::: Checking installer dependencies..."
dependency_package_install() { for i in "${INSTALLER_DEPS[@]}"; do
# 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 -n "::: Checking for $i..." 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...." echo -n " Not found! Installing...."
${PKG_INSTALL} "$i" > /dev/null 2>&1 ${PKG_INSTALL} "$i" > /dev/null 2>&1
if ! package_check ${i} &>/dev/null; then echo " done!"
echo "::: ERROR, package ${i} has not been installed, please run ${UPDATE_PKG_CACHE} and try install again."
exit 1
else
echo " done!"
fi
else else
echo " already installed!" echo " already installed!"
fi fi
done 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
done
}
getGitFiles() { getGitFiles() {
# Setup git repos for base files and web admin # Setup git repos for base files and web admin
echo ":::" echo ":::"
@ -789,10 +796,7 @@ finalExports() {
installPihole() { installPihole() {
# Install base files and web interface # Install base files and web interface
echo "Checking for Pi-hole dependencies" checkForDependencies # done
if ! dependency_package_install PIHOLE_DEPS[@]; then
exit 1
fi
stopServices stopServices
setUser setUser
if [ ! -d "/var/www/html" ]; then if [ ! -d "/var/www/html" ]; then
@ -821,10 +825,7 @@ installPihole() {
updatePihole() { updatePihole() {
# Install base files and web interface # Install base files and web interface
echo "Checking for Pi-hole dependencies" checkForDependencies # done
if ! dependency_package_install PIHOLE_DEPS[@]; then
exit 1
fi
stopServices stopServices
getGitFiles getGitFiles
installScripts installScripts
@ -927,14 +928,8 @@ else
verifyFreeDiskSpace verifyFreeDiskSpace
fi fi
# Check the package cache and update if necessary
check_cache_freshness
# Install packages used by this installation script # Install packages used by this installation script
echo "::: Checking for installer dependencies..." installerDependencies
if ! dependency_package_install INSTALLER_DEPS[@]; then
exit 1
fi
if [[ ${useUpdateVars} == false ]]; then if [[ ${useUpdateVars} == false ]]; then
welcomeDialogs welcomeDialogs
@ -990,4 +985,4 @@ echo "::: The install log is located at: /etc/pihole/install.log"
echo "::: View the web interface at http://pi.hole/admin or http://${IPv4addr%/*}/admin" echo "::: View the web interface at http://pi.hole/admin or http://${IPv4addr%/*}/admin"
} }
main "$@" main "$@"