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

Single dependency package check function, will exit if any errors with message to update cache.

This commit is contained in:
Dan Schaper 2016-10-09 13:43:01 -07:00
parent 6772603c15
commit f5be8b2a5e

View File

@ -615,38 +615,28 @@ check_cache_freshness() {
fi
}
installerDependencies() {
echo ":::"
echo "::: Checking installer dependencies..."
for i in "${INSTALLER_DEPS[@]}"; do
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 -n "::: Checking for $i..."
if ! package_check ${i} &>/dev/null; then
echo -n " Not found! Installing...."
${PKG_INSTALL} "$i" > /dev/null 2>&1
echo " done!"
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!"
fi
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
done
}
getGitFiles() {
# Setup git repos for base files and web admin
echo ":::"
@ -799,7 +789,8 @@ finalExports() {
installPihole() {
# Install base files and web interface
checkForDependencies # done
echo "Checking for Pi-hole dependencies"
dependency_package_install PIHOLE_DEPS[@] # done
stopServices
setUser
if [ ! -d "/var/www/html" ]; then
@ -828,7 +819,8 @@ installPihole() {
updatePihole() {
# Install base files and web interface
checkForDependencies # done
echo "Checking for Pi-hole dependencies"
dependency_package_install PIHOLE_DEPS[@] # done
stopServices
getGitFiles
installScripts
@ -935,7 +927,8 @@ fi
check_cache_freshness
# Install packages used by this installation script
installerDependencies
echo "::: Checking for installer dependencies..."
dependency_package_install INSTALLER_DEPS[@]
if [[ ${useUpdateVars} == false ]]; then
welcomeDialogs