mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-08 16:40:17 +00:00
Single dependency package check function, will exit if any errors with message to update cache.
This commit is contained in:
parent
6772603c15
commit
f5be8b2a5e
1 changed files with 18 additions and 25 deletions
|
@ -615,38 +615,28 @@ check_cache_freshness() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installerDependencies() {
|
dependency_package_install() {
|
||||||
echo ":::"
|
# Install and verify package installation, exit out if any errors are detected
|
||||||
echo "::: Checking installer dependencies..."
|
# Takes array as argument then iterates over array
|
||||||
for i in "${INSTALLER_DEPS[@]}"; do
|
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
|
if ! package_check ${i} &>/dev/null; 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
|
||||||
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
|
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 ":::"
|
||||||
|
@ -799,7 +789,8 @@ finalExports() {
|
||||||
|
|
||||||
installPihole() {
|
installPihole() {
|
||||||
# Install base files and web interface
|
# Install base files and web interface
|
||||||
checkForDependencies # done
|
echo "Checking for Pi-hole dependencies"
|
||||||
|
dependency_package_install PIHOLE_DEPS[@] # done
|
||||||
stopServices
|
stopServices
|
||||||
setUser
|
setUser
|
||||||
if [ ! -d "/var/www/html" ]; then
|
if [ ! -d "/var/www/html" ]; then
|
||||||
|
@ -828,7 +819,8 @@ installPihole() {
|
||||||
|
|
||||||
updatePihole() {
|
updatePihole() {
|
||||||
# Install base files and web interface
|
# Install base files and web interface
|
||||||
checkForDependencies # done
|
echo "Checking for Pi-hole dependencies"
|
||||||
|
dependency_package_install PIHOLE_DEPS[@] # done
|
||||||
stopServices
|
stopServices
|
||||||
getGitFiles
|
getGitFiles
|
||||||
installScripts
|
installScripts
|
||||||
|
@ -935,7 +927,8 @@ fi
|
||||||
check_cache_freshness
|
check_cache_freshness
|
||||||
|
|
||||||
# Install packages used by this installation script
|
# Install packages used by this installation script
|
||||||
installerDependencies
|
echo "::: Checking for installer dependencies..."
|
||||||
|
dependency_package_install INSTALLER_DEPS[@]
|
||||||
|
|
||||||
if [[ ${useUpdateVars} == false ]]; then
|
if [[ ${useUpdateVars} == false ]]; then
|
||||||
welcomeDialogs
|
welcomeDialogs
|
||||||
|
|
Loading…
Add table
Reference in a new issue