mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 12:40:56 +00:00
Merge pull request #2398 from pi-hole/rpm_distro_checks
WIP: Update RPM distro checks
This commit is contained in:
commit
cf7180af5b
@ -244,20 +244,20 @@ elif command -v rpm &> /dev/null; then
|
||||
LIGHTTPD_GROUP="lighttpd"
|
||||
LIGHTTPD_CFG="lighttpd.conf.fedora"
|
||||
# If the host OS is Fedora,
|
||||
if grep -qi 'fedora' /etc/redhat-release; then
|
||||
if grep -qiE 'fedora|fedberry' /etc/redhat-release; then
|
||||
# all required packages should be available by default with the latest fedora release
|
||||
# ensure 'php-json' is installed on Fedora (installed as dependency on CentOS7 + Remi repository)
|
||||
PIHOLE_WEB_DEPS+=('php-json')
|
||||
# or if host OS is CentOS,
|
||||
elif grep -qi 'centos' /etc/redhat-release; then
|
||||
elif grep -qiE 'centos|scientific' /etc/redhat-release; then
|
||||
# Pi-Hole currently supports CentOS 7+ with PHP7+
|
||||
SUPPORTED_CENTOS_VERSION=7
|
||||
SUPPORTED_CENTOS_PHP_VERSION=7
|
||||
# Check current CentOS major release version
|
||||
CURRENT_CENTOS_VERSION=$(rpm -q --queryformat '%{VERSION}' centos-release)
|
||||
CURRENT_CENTOS_VERSION=$(grep -oP '(?<= )[0-9]+(?=\.)' /etc/redhat-release)
|
||||
# Check if CentOS version is supported
|
||||
if [[ $CURRENT_CENTOS_VERSION -lt $SUPPORTED_CENTOS_VERSION ]]; then
|
||||
echo -e " ${CROSS} CentOS $CURRENT_CENTOS_VERSION is not suported."
|
||||
echo -e " ${CROSS} CentOS $CURRENT_CENTOS_VERSION is not supported."
|
||||
echo -e " Please update to CentOS release $SUPPORTED_CENTOS_VERSION or later"
|
||||
# exit the installer
|
||||
exit
|
||||
@ -305,13 +305,16 @@ elif command -v rpm &> /dev/null; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# If not a supported version of Fedora or CentOS,
|
||||
echo -e " ${CROSS} Unsupported RPM based distribution"
|
||||
# exit the installer
|
||||
exit
|
||||
# Warn user of unsupported version of Fedora or CentOS
|
||||
if ! whiptail --defaultno --title "Unsupported RPM based distribution" --yesno "Would you like to continue installation on an unsupported RPM based distribution?\\n\\nPlease ensure the following packages have been installed manually:\\n\\n- lighttpd\\n- lighttpd-fastcgi\\n- PHP version 7+" ${r} ${c}; then
|
||||
echo -e " ${CROSS} Aborting installation due to unsupported RPM based distribution"
|
||||
exit # exit the installer
|
||||
else
|
||||
echo -e " ${INFO} Continuing installation with unsupported RPM based distribution"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If neither apt-get or rmp/dnf are found
|
||||
# If neither apt-get or yum/dnf package managers were found
|
||||
else
|
||||
# it's not an OS we can support,
|
||||
echo -e " ${CROSS} OS distribution not supported"
|
||||
|
@ -31,20 +31,13 @@ def test_release_supported_version_check_centos(Pihole):
|
||||
'''
|
||||
confirms installer exits on unsupported releases of CentOS
|
||||
'''
|
||||
# mock CentOS release < 7 (unsupported)
|
||||
mock_command_2(
|
||||
'rpm',
|
||||
{"-q --queryformat '%{VERSION}' centos-release'": (
|
||||
'5',
|
||||
'0'
|
||||
)},
|
||||
Pihole
|
||||
)
|
||||
# modify /etc/redhat-release to mock an unsupported CentOS release
|
||||
Pihole.run('echo "CentOS Linux release 6.9" > /etc/redhat-release')
|
||||
distro_check = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
distro_check
|
||||
''')
|
||||
expected_stdout = cross_box + (' CentOS is not suported.')
|
||||
expected_stdout = cross_box + (' CentOS 6 is not supported.')
|
||||
assert expected_stdout in distro_check.stdout
|
||||
expected_stdout = 'Please update to CentOS release 7 or later'
|
||||
assert expected_stdout in distro_check.stdout
|
||||
|
Loading…
Reference in New Issue
Block a user