Grouped common dependencies of distros (#5762)

This commit is contained in:
yubiuser 2024-09-28 13:37:11 +02:00 committed by GitHub
commit c0e39087bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 12 deletions

View file

@ -361,8 +361,10 @@ test_dpkg_lock() {
# Compatibility # Compatibility
package_manager_detect() { package_manager_detect() {
# TODO - pull common packages for both distributions out into a common variable, then add # pull common packages for both distributions out into a common variable
# the distro-specific ones below. OS_CHECK_COMMON_DEPS=(grep)
PIHOLE_COMMON_DEPS=(curl psmisc sudo unzip jq);
INSTALLER_COMMON_DEPS=(git dialog ca-certificates)
# First check to see if apt-get is installed. # First check to see if apt-get is installed.
if is_command apt-get; then if is_command apt-get; then
@ -378,11 +380,11 @@ package_manager_detect() {
# Update package cache # Update package cache
update_package_cache || exit 1 update_package_cache || exit 1
# Packages required to perform the os_check and FTL binary detection # Packages required to perform the os_check and FTL binary detection
OS_CHECK_DEPS=(grep dnsutils binutils) OS_CHECK_DEPS=(dnsutils binutils)
# Packages required to run this install script # Packages required to run this install script
INSTALLER_DEPS=(git iproute2 dialog ca-certificates) INSTALLER_DEPS=(iproute2)
# Packages required to run Pi-hole # Packages required to run Pi-hole
PIHOLE_DEPS=(cron curl iputils-ping psmisc sudo unzip libcap2-bin dns-root-data libcap2 netcat-openbsd procps jq lshw bash-completion) PIHOLE_DEPS=(cron iputils-ping libcap2-bin dns-root-data libcap2 netcat-openbsd procps lshw bash-completion)
# If apt-get is not found, check for rpm. # If apt-get is not found, check for rpm.
elif is_command rpm; then elif is_command rpm; then
@ -397,9 +399,9 @@ package_manager_detect() {
PKG_INSTALL=("${PKG_MANAGER}" install -y) PKG_INSTALL=("${PKG_MANAGER}" install -y)
# CentOS package manager returns 100 when there are packages to update so we need to || true to prevent the script from exiting. # CentOS package manager returns 100 when there are packages to update so we need to || true to prevent the script from exiting.
PKG_COUNT="${PKG_MANAGER} check-update | grep -E '(.i686|.x86|.noarch|.arm|.src|.riscv64)' | wc -l || true" PKG_COUNT="${PKG_MANAGER} check-update | grep -E '(.i686|.x86|.noarch|.arm|.src|.riscv64)' | wc -l || true"
OS_CHECK_DEPS=(grep bind-utils) OS_CHECK_DEPS=(bind-utils)
INSTALLER_DEPS=(git dialog iproute newt procps-ng chkconfig ca-certificates binutils) INSTALLER_DEPS=(iproute newt procps-ng chkconfig binutils)
PIHOLE_DEPS=(cronie curl findutils sudo unzip psmisc libcap nmap-ncat jq lshw bash-completion) PIHOLE_DEPS=(cronie findutils libcap nmap-ncat lshw bash-completion)
# If neither apt-get or yum/dnf package managers were found # If neither apt-get or yum/dnf package managers were found
else else
@ -2268,7 +2270,7 @@ main() {
# Install packages necessary to perform os_check # Install packages necessary to perform os_check
printf " %b Checking for / installing Required dependencies for OS Check...\\n" "${INFO}" printf " %b Checking for / installing Required dependencies for OS Check...\\n" "${INFO}"
install_dependent_packages "${OS_CHECK_DEPS[@]}" install_dependent_packages "${OS_CHECK_COMMON_DEPS[@]}" "${OS_CHECK_DEPS[@]}"
# Check that the installed OS is officially supported - display warning if not # Check that the installed OS is officially supported - display warning if not
os_check os_check
@ -2285,7 +2287,7 @@ main() {
# Install packages used by this installation script # Install packages used by this installation script
printf " %b Checking for / installing Required dependencies for this install script...\\n" "${INFO}" printf " %b Checking for / installing Required dependencies for this install script...\\n" "${INFO}"
install_dependent_packages "${INSTALLER_DEPS[@]}" install_dependent_packages "${INSTALLER_COMMON_DEPS[@]}" "${INSTALLER_DEPS[@]}"
# if it's running unattended, # if it's running unattended,
if [[ "${runUnattended}" == true ]]; then if [[ "${runUnattended}" == true ]]; then
@ -2326,7 +2328,7 @@ main() {
clone_or_update_repos clone_or_update_repos
# Install the Core dependencies # Install the Core dependencies
local dep_install_list=("${PIHOLE_DEPS[@]}") local dep_install_list=("${PIHOLE_COMMON_DEPS[@]}" "${PIHOLE_DEPS[@]}")
# Install packages used by the actual software # Install packages used by the actual software
printf " %b Checking for / installing Required dependencies for Pi-hole software...\\n" "${INFO}" printf " %b Checking for / installing Required dependencies for Pi-hole software...\\n" "${INFO}"

View file

@ -45,7 +45,7 @@ source "${setupVars}"
package_manager_detect package_manager_detect
# Uninstall packages used by the Pi-hole # Uninstall packages used by the Pi-hole
DEPS=("${INSTALLER_DEPS[@]}" "${PIHOLE_DEPS[@]}" "${OS_CHECK_DEPS[@]}") DEPS=("${INSTALLER_COMMON_DEPS[@]}" "${PIHOLE_COMMON_DEPS[@]}" "${OS_CHECK_COMMON_DEPS[@]}" "${INSTALLER_DEPS[@]}" "${PIHOLE_DEPS[@]}" "${OS_CHECK_DEPS[@]}")
# Compatibility # Compatibility
if [ -x "$(command -v apt-get)" ]; then if [ -x "$(command -v apt-get)" ]; then