mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
rename select_rpm_php and simplify it to remove code no longer needed (discussed internally removing the unsupported dialog here to match behaviour on non rpm distros)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
9c03915cb0
commit
b613758419
5 changed files with 11 additions and 53 deletions
|
@ -375,22 +375,11 @@ package_manager_detect() {
|
|||
fi
|
||||
}
|
||||
|
||||
select_rpm_php(){
|
||||
local unsupported_dialog=0
|
||||
# If the host OS is Fedora,
|
||||
if grep -qiE 'fedora|fedberry' /etc/redhat-release; then
|
||||
# all required packages should be available by default with the latest fedora release
|
||||
: # continue
|
||||
# or if host OS is CentOS,
|
||||
elif grep -qiE 'centos|scientific|alma|rocky' /etc/redhat-release; then
|
||||
SUPPORTED_CENTOS_VERSION=8
|
||||
check_epel_repo_required(){
|
||||
# If the host OS is centos (or a derivative),
|
||||
if grep -qiE 'centos|scientific|alma|rocky' /etc/redhat-release; then
|
||||
# Check current CentOS major release version
|
||||
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
|
||||
unsupported_dialog=1
|
||||
fi
|
||||
|
||||
if rpm -qa | grep -qi 'epel'; then
|
||||
printf " %b EPEL repository already installed\\n" "${TICK}"
|
||||
else
|
||||
|
@ -400,37 +389,6 @@ select_rpm_php(){
|
|||
"${PKG_INSTALL[@]}" ${EPEL_PKG}
|
||||
printf " %b Installed %s\\n" "${TICK}" "${EPEL_PKG}"
|
||||
fi
|
||||
else
|
||||
unsupported_dialog=1
|
||||
fi
|
||||
|
||||
if [[ ${unsupported_dialog} -eq 1 ]];then
|
||||
# Warn user of unsupported version of Fedora or CentOS
|
||||
dialog --no-shadow --keep-tite \
|
||||
--title "Unsupported RPM based distribution" \
|
||||
--defaultno \
|
||||
--no-button "Exit" \
|
||||
--yes-button "Continue" \
|
||||
--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}" && result=0 || result=$?
|
||||
|
||||
case ${result} in
|
||||
# User chose to continue installation on an unsupported RPM based distribution
|
||||
"${DIALOG_OK}")
|
||||
printf " %b User opted to continue installation on an unsupported RPM based distribution.\\n" "${INFO}"
|
||||
;;
|
||||
# User chose not to continue installation on an unsupported RPM based distribution
|
||||
"${DIALOG_CANCEL}")
|
||||
printf " %b User opted not to continue installation on an unsupported RPM based distribution.\\n" "${INFO}"
|
||||
exit 1
|
||||
;;
|
||||
"${DIALOG_ESC}")
|
||||
printf " %b Escape pressed, exiting installer at unsupported RPM based distribution dialog window\\n" "${CROSS}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -2580,7 +2538,7 @@ main() {
|
|||
|
||||
#In case of RPM based distro, select the proper PHP version
|
||||
if [[ "$PKG_MANAGER" == "yum" || "$PKG_MANAGER" == "dnf" ]] ; then
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -1117,7 +1117,7 @@ def test_package_manager_has_pihole_deps(host):
|
|||
output = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
install_dependent_packages ${PIHOLE_DEPS[@]}
|
||||
''')
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ def test_package_manager_has_web_deps(host):
|
|||
output = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
install_dependent_packages ${PIHOLE_WEB_DEPS[@]}
|
||||
''')
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ def test_php_upgrade_default_continue_centos_gte_8(host):
|
|||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
''')
|
||||
unexpected_stdout = info_box + (' User opt-out of PHP 7 upgrade on CentOS.'
|
||||
' Deprecated PHP may be in use.')
|
||||
|
@ -34,7 +34,7 @@ def test_php_upgrade_user_optout_skipped_centos_gte_8(host):
|
|||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
''')
|
||||
unexpected_stdout = info_box + (' User opt-out of PHP 7 upgrade on CentOS.'
|
||||
' Deprecated PHP may be in use.')
|
||||
|
@ -55,7 +55,7 @@ def test_php_upgrade_user_optin_skipped_centos_gte_8(host):
|
|||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
''')
|
||||
assert 'opt-out' not in package_manager_detect.stdout
|
||||
unexpected_stdout = info_box + (' Enabling Remi\'s RPM repository '
|
||||
|
|
|
@ -14,7 +14,7 @@ def test_enable_epel_repository_centos(host):
|
|||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
''')
|
||||
expected_stdout = info_box + (' Enabling EPEL package repository '
|
||||
'(https://fedoraproject.org/wiki/EPEL)')
|
||||
|
|
|
@ -6,7 +6,7 @@ def test_epel_and_remi_not_installed_fedora(host):
|
|||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
check_epel_repo_required
|
||||
''')
|
||||
assert package_manager_detect.stdout == ''
|
||||
|
||||
|
|
Loading…
Reference in a new issue