mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Install script comment tweaks (#4361)
This commit is contained in:
parent
7b0513d1e6
commit
5b03160295
2 changed files with 10 additions and 10 deletions
|
@ -262,10 +262,10 @@ os_check() {
|
||||||
|
|
||||||
# Compatibility
|
# Compatibility
|
||||||
package_manager_detect() {
|
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
|
if is_command apt-get ; then
|
||||||
# Set some global variables here
|
# 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"
|
PKG_MANAGER="apt-get"
|
||||||
# A variable to store the command used to update the package cache
|
# A variable to store the command used to update the package cache
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||||
|
@ -319,7 +319,7 @@ if is_command apt-get ; then
|
||||||
return 0
|
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
|
elif is_command rpm ; then
|
||||||
# Then check if dnf or yum is the package manager
|
# Then check if dnf or yum is the package manager
|
||||||
if is_command dnf ; then
|
if is_command dnf ; then
|
||||||
|
@ -328,7 +328,7 @@ elif is_command rpm ; then
|
||||||
PKG_MANAGER="yum"
|
PKG_MANAGER="yum"
|
||||||
fi
|
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_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"
|
||||||
OS_CHECK_DEPS=(grep bind-utils)
|
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
|
# If neither apt-get or yum/dnf package managers were found
|
||||||
else
|
else
|
||||||
# it's not an OS we can support,
|
# we cannot install required packages
|
||||||
printf " %b OS distribution not supported\\n" "${CROSS}"
|
printf " %b No supported package manager found\\n" "${CROSS}"
|
||||||
# so exit the installer
|
# so exit the installer
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -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/apt-get')
|
||||||
Pihole.run('rm -rf /usr/bin/rpm')
|
Pihole.run('rm -rf /usr/bin/rpm')
|
||||||
package_manager_detect = Pihole.run('''
|
package_manager_detect = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
package_manager_detect
|
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 expected_stdout in package_manager_detect.stdout
|
||||||
# assert package_manager_detect.rc == 1
|
# assert package_manager_detect.rc == 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue