mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Fedora dependency installer overhaul
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net> Modify Fedora dependency installer Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net> Fedora now installs and arrays only non-installed packages. Fedora also noops the cache update, since it updates at every dnf call anyays. Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
852341c601
commit
dc22a50dcc
@ -105,23 +105,22 @@ elif [ $(command -v rpm) ]; then
|
||||
PKG_MANAGER="yum"
|
||||
fi
|
||||
PKG_CACHE="/var/cache/${PKG_MANAGER}"
|
||||
UPDATE_PKG_CACHE="${PKG_MANAGER} check-update"
|
||||
#Every yum/dnf call will autmomatically update the cache. No-op here, cach updates when
|
||||
#We get available package count.
|
||||
#Also a bare `dnf check-update will return 100 as a retval, blows up set -e
|
||||
UPDATE_PKG_CACHE=":"
|
||||
PKG_INSTALL="${PKG_MANAGER} install -y"
|
||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||
INSTALLER_DEPS=(git iproute net-tools newt procps-ng)
|
||||
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq epel-release findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget)
|
||||
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils lighttpd lighttpd-fastcgi nmap-ncat php php-common php-cli sudo unzip wget)
|
||||
|
||||
if grep -q 'Fedora' /etc/redhat-release; then
|
||||
PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release});
|
||||
if ! grep -q 'Fedora' /etc/redhat-release; then
|
||||
PIHOLE_DEPS=("${PIHOLE_DEPS[@]}" "epel-release");
|
||||
fi
|
||||
LIGHTTPD_USER="lighttpd"
|
||||
LIGHTTPD_GROUP="lighttpd"
|
||||
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
||||
DNSMASQ_USER="nobody"
|
||||
|
||||
package_check_install() {
|
||||
rpm -qa | grep ^"${1}"- > /dev/null || ${PKG_INSTALL} "${1}"
|
||||
}
|
||||
else
|
||||
echo "OS distribution not supported"
|
||||
exit
|
||||
@ -715,7 +714,7 @@ update_pacakge_cache() {
|
||||
#update package lists
|
||||
echo ":::"
|
||||
echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..."
|
||||
${UPDATE_PKG_CACHE} &> /dev/null
|
||||
${UPDATE_PKG_CACHE}
|
||||
echo " done!"
|
||||
fi
|
||||
}
|
||||
@ -758,8 +757,22 @@ install_dependent_packages() {
|
||||
installArray+=("${i}")
|
||||
fi
|
||||
done
|
||||
debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}"
|
||||
debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
#Fedora
|
||||
for i in "${argArray1[@]}"; do
|
||||
echo -n "::: Checking for $i..."
|
||||
if dnf -q list installed "${i}" &> /dev/null; then
|
||||
echo " installed!"
|
||||
else
|
||||
echo " added to install list!"
|
||||
installArray+=("${i}")
|
||||
fi
|
||||
done
|
||||
${PKG_INSTALL} "${installArray[@]}"
|
||||
return 0
|
||||
}
|
||||
|
||||
CreateLogFile() {
|
||||
|
Loading…
Reference in New Issue
Block a user