From d68a2ffaf312071c2d849689dab178c548b73628 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 3 Aug 2021 22:48:03 +0100 Subject: [PATCH] Install only minimal requiered package before performing os_check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian König Signed-off-by: Adam Warner --- automated install/basic-install.sh | 16 +++++++++++----- test/test_automated_install.py | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 71aa8b49..9cad94b3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -354,10 +354,12 @@ if is_command apt-get ; then printf " %b Aborting installation: No SQLite PHP module was found in APT repository.\\n" "${CROSS}" exit 1 fi + # Packages required to perfom the os_check (stored as an array) + OS_CHECK_DEPS=(grep dnsutils) # Packages required to run this install script (stored as an array) - INSTALLER_DEPS=(dhcpcd5 git "${iproute_pkg}" whiptail dnsutils) + INSTALLER_DEPS=(git "${iproute_pkg}" whiptail) # Packages required to run Pi-hole (stored as an array) - PIHOLE_DEPS=(cron curl iputils-ping lsof netcat psmisc sudo unzip idn2 sqlite3 libcap2-bin dns-root-data libcap2) + PIHOLE_DEPS=(dhcpcd5 cron curl iputils-ping lsof netcat psmisc sudo unzip idn2 sqlite3 libcap2-bin dns-root-data libcap2) # Packages required for the Web admin interface (stored as an array) # It's useful to separate this from Pi-hole, since the two repos are also setup separately PIHOLE_WEB_DEPS=(lighttpd "${phpVer}-common" "${phpVer}-cgi" "${phpVer}-${phpSqlite}" "${phpVer}-xml" "${phpVer}-intl") @@ -400,7 +402,8 @@ elif is_command rpm ; then # These variable names match the ones in the Debian family. See above for an explanation of what they are for. PKG_INSTALL=("${PKG_MANAGER}" install -y) PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l" - INSTALLER_DEPS=(git iproute newt procps-ng which chkconfig bind-utils) + OS_CHECK_DEPS=(grep bind-utils) + INSTALLER_DEPS=(git iproute newt procps-ng which chkconfig) PIHOLE_DEPS=(cronie curl findutils nmap-ncat sudo unzip libidn2 psmisc sqlite libcap lsof) PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php-common php-cli php-pdo php-xml php-json php-intl) LIGHTTPD_USER="lighttpd" @@ -2662,12 +2665,15 @@ main() { # Notify user of package availability notify_package_updates_available - # Install packages used by this installation script - install_dependent_packages "${INSTALLER_DEPS[@]}" + # Install packages necessary to perform os_check + install_dependent_packages "${OS_CHECK_DEPS[@]}" # Check that the installed OS is officially supported - display warning if not os_check + # Install packages used by this installation script + install_dependent_packages "${INSTALLER_DEPS[@]}" + # Check if SELinux is Enforcing checkSelinux diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 21468cd7..593c19d2 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -568,6 +568,7 @@ def test_os_check_fails(Pihole): Pihole.run(''' source /opt/pihole/basic-install.sh package_manager_detect + install_dependent_packages ${OS_CHECK_DEPS[@]} install_dependent_packages ${INSTALLER_DEPS[@]} cat < /etc/os-release ID=UnsupportedOS @@ -587,6 +588,7 @@ def test_os_check_passes(Pihole): Pihole.run(''' source /opt/pihole/basic-install.sh package_manager_detect + install_dependent_packages ${OS_CHECK_DEPS[@]} install_dependent_packages ${INSTALLER_DEPS[@]} ''') detectOS = Pihole.run('''