1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-17 21:59:55 +00:00

Install script comment tweaks (#4361)

This commit is contained in:
Adam Warner 2021-10-04 11:40:53 +01:00 committed by GitHub
parent 7b0513d1e6
commit 5b03160295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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