mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Self contain package_check
into package_check_install
. Passes set -e
test.
This commit is contained in:
parent
7131ff27c3
commit
d4bf85b67c
1 changed files with 12 additions and 31 deletions
|
@ -79,8 +79,8 @@ if [ -x "$(command -v apt-get)" ];then
|
||||||
LIGHTTPD_USER="www-data"
|
LIGHTTPD_USER="www-data"
|
||||||
LIGHTTPD_GROUP="www-data"
|
LIGHTTPD_GROUP="www-data"
|
||||||
LIGHTTPD_CFG="lighttpd.conf.debian"
|
LIGHTTPD_CFG="lighttpd.conf.debian"
|
||||||
package_check() {
|
package_check_install() {
|
||||||
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed" || ${PKG_INSTALL} "$1"
|
||||||
}
|
}
|
||||||
elif [ -x "$(command -v rpm)" ];then
|
elif [ -x "$(command -v rpm)" ];then
|
||||||
# Fedora Family
|
# Fedora Family
|
||||||
|
@ -99,7 +99,7 @@ elif [ -x "$(command -v rpm)" ];then
|
||||||
LIGHTTPD_USER="lighttpd"
|
LIGHTTPD_USER="lighttpd"
|
||||||
LIGHTTPD_GROUP="lighttpd"
|
LIGHTTPD_GROUP="lighttpd"
|
||||||
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
||||||
package_check() {
|
package_check_install() {
|
||||||
rpm -qa | grep ^$1- > /dev/null
|
rpm -qa | grep ^$1- > /dev/null
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -613,31 +613,18 @@ installerDependencies() {
|
||||||
echo "::: Checking installer dependencies..."
|
echo "::: Checking installer dependencies..."
|
||||||
for i in "${INSTALLER_DEPS[@]}"; do
|
for i in "${INSTALLER_DEPS[@]}"; do
|
||||||
echo -n "::: Checking for $i..."
|
echo -n "::: Checking for $i..."
|
||||||
package_check ${i} > /dev/null
|
package_check_install ${i} > /dev/null
|
||||||
if ! [ $? -eq 0 ]; then
|
echo " installed!"
|
||||||
echo -n " Not found! Installing...."
|
|
||||||
${PKG_INSTALL} "$i" > /dev/null 2>&1
|
|
||||||
echo " done!"
|
|
||||||
else
|
|
||||||
echo " already installed!"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForDependencies() {
|
checkForDependencies() {
|
||||||
# Install dependencies for Pi-Hole
|
# Install dependencies for Pi-Hole
|
||||||
echo "::: Checking Pi-Hole dependencies:"
|
echo "::: Checking Pi-Hole dependencies:"
|
||||||
|
|
||||||
for i in "${PIHOLE_DEPS[@]}"; do
|
for i in "${PIHOLE_DEPS[@]}"; do
|
||||||
echo -n "::: Checking for $i..."
|
echo -n "::: Checking for $i..."
|
||||||
package_check ${i} > /dev/null
|
package_check_install ${i} > /dev/null
|
||||||
if ! [ $? -eq 0 ]; then
|
echo " installed!"
|
||||||
echo -n " Not found! Installing...."
|
|
||||||
${PKG_INSTALL} "$i" > /dev/null & spinner $!
|
|
||||||
echo " done!"
|
|
||||||
else
|
|
||||||
echo " already installed!"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,14 +826,8 @@ configureSelinux() {
|
||||||
if [ -x "$(command -v getenforce)" ]; then
|
if [ -x "$(command -v getenforce)" ]; then
|
||||||
printf "\n::: SELinux Detected\n"
|
printf "\n::: SELinux Detected\n"
|
||||||
printf ":::\tChecking for SELinux policy development packages..."
|
printf ":::\tChecking for SELinux policy development packages..."
|
||||||
package_check "selinux-policy-devel" > /dev/null
|
package_check_install "selinux-policy-devel" > /dev/null
|
||||||
if ! [ $? -eq 0 ]; then
|
echo " installed!"
|
||||||
echo -n " Not found! Installing...."
|
|
||||||
${PKG_INSTALL} "selinux-policy-devel" > /dev/null & spinner $!
|
|
||||||
echo " done!"
|
|
||||||
else
|
|
||||||
echo " already installed!"
|
|
||||||
fi
|
|
||||||
printf "::: Enabling httpd server side includes (SSI).. "
|
printf "::: Enabling httpd server side includes (SSI).. "
|
||||||
setsebool -P httpd_ssi_exec on
|
setsebool -P httpd_ssi_exec on
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|
Loading…
Reference in a new issue