From 5b03160295103aa38a7b2554fc057fea03b04d97 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 4 Oct 2021 11:40:53 +0100 Subject: [PATCH] Install script comment tweaks (#4361) --- automated install/basic-install.sh | 12 ++++++------ test/test_automated_install.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index f6eeca8b..c1a1c613 100644 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -262,10 +262,10 @@ os_check() { # Compatibility package_manager_detect() { -# If apt-get is installed, then we know it's part of the Debian family +# First check to see if apt-get is installed. if is_command apt-get ; then # Set some global variables here - # We don't set them earlier since the family might be Red Hat, so these values would be different + # We don't set them earlier since the installed package manager might be rpm, so these values would be different PKG_MANAGER="apt-get" # A variable to store the command used to update the package cache UPDATE_PKG_CACHE="${PKG_MANAGER} update" @@ -319,7 +319,7 @@ if is_command apt-get ; then return 0 } -# If apt-get is not found, check for rpm to see if it's a Red Hat family OS +# If apt-get is not found, check for rpm. elif is_command rpm ; then # Then check if dnf or yum is the package manager if is_command dnf ; then @@ -328,7 +328,7 @@ elif is_command rpm ; then PKG_MANAGER="yum" fi - # These variable names match the ones in the Debian family. See above for an explanation of what they are for. + # These variable names match the ones for apt-get. 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" OS_CHECK_DEPS=(grep bind-utils) @@ -341,8 +341,8 @@ elif is_command rpm ; then # If neither apt-get or yum/dnf package managers were found else - # it's not an OS we can support, - printf " %b OS distribution not supported\\n" "${CROSS}" + # we cannot install required packages + printf " %b No supported package manager found\\n" "${CROSS}" # so exit the installer exit fi diff --git a/test/test_automated_install.py b/test/test_automated_install.py index eb1bfd2c..37ebdad2 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -11,18 +11,18 @@ from .conftest import ( ) -def test_supported_operating_system(Pihole): +def test_supported_package_manager(Pihole): ''' - confirm installer exists on unsupported distribution + confirm installer exits when no supported package manager found ''' - # break supported package managers to emulate an unsupported distribution + # break supported package managers Pihole.run('rm -rf /usr/bin/apt-get') Pihole.run('rm -rf /usr/bin/rpm') package_manager_detect = Pihole.run(''' source /opt/pihole/basic-install.sh package_manager_detect ''') - expected_stdout = cross_box + ' OS distribution not supported' + expected_stdout = cross_box + ' No supported package manager found' assert expected_stdout in package_manager_detect.stdout # assert package_manager_detect.rc == 1