mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +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
1 changed files with 23 additions and 10 deletions
|
@ -105,23 +105,22 @@ elif [ $(command -v rpm) ]; then
|
||||||
PKG_MANAGER="yum"
|
PKG_MANAGER="yum"
|
||||||
fi
|
fi
|
||||||
PKG_CACHE="/var/cache/${PKG_MANAGER}"
|
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_INSTALL="${PKG_MANAGER} install -y"
|
||||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||||
INSTALLER_DEPS=(git iproute net-tools newt procps-ng)
|
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
|
if ! grep -q 'Fedora' /etc/redhat-release; then
|
||||||
PIHOLE_DEPS=(${PIHOLE_DEPS#epel-release});
|
PIHOLE_DEPS=("${PIHOLE_DEPS[@]}" "epel-release");
|
||||||
fi
|
fi
|
||||||
LIGHTTPD_USER="lighttpd"
|
LIGHTTPD_USER="lighttpd"
|
||||||
LIGHTTPD_GROUP="lighttpd"
|
LIGHTTPD_GROUP="lighttpd"
|
||||||
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
||||||
DNSMASQ_USER="nobody"
|
DNSMASQ_USER="nobody"
|
||||||
|
|
||||||
package_check_install() {
|
|
||||||
rpm -qa | grep ^"${1}"- > /dev/null || ${PKG_INSTALL} "${1}"
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
echo "OS distribution not supported"
|
echo "OS distribution not supported"
|
||||||
exit
|
exit
|
||||||
|
@ -715,7 +714,7 @@ update_pacakge_cache() {
|
||||||
#update package lists
|
#update package lists
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..."
|
echo -n "::: ${PKG_MANAGER} update has not been run today. Running now..."
|
||||||
${UPDATE_PKG_CACHE} &> /dev/null
|
${UPDATE_PKG_CACHE}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -758,8 +757,22 @@ install_dependent_packages() {
|
||||||
installArray+=("${i}")
|
installArray+=("${i}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}"
|
debconf-apt-progress -- ${PKG_INSTALL} "${installArray[@]}"
|
||||||
|
return 0
|
||||||
fi
|
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() {
|
CreateLogFile() {
|
||||||
|
|
Loading…
Reference in a new issue