update distro_check for centos

Signed-off-by: bcambl <blayne@blaynecampbell.com>
This commit is contained in:
bcambl
2021-03-12 15:58:21 -06:00
committed by Adam Warner
parent 8336d49853
commit 8cb175811f

View File

@@ -356,19 +356,10 @@ elif is_command rpm ; then
: # continue : # continue
# or if host OS is CentOS, # or if host OS is CentOS,
elif grep -qiE 'centos|scientific' /etc/redhat-release; then elif grep -qiE 'centos|scientific' /etc/redhat-release; then
# Pi-Hole currently supports CentOS 7+ # CentOS 7 requires the EPEL repository for the following package(s): libidn2
SUPPORTED_CENTOS_VERSION=7
# Check current CentOS major release version
CURRENT_CENTOS_VERSION=$(grep -oP '(?<= )[0-9]+(?=\.?)' /etc/redhat-release) CURRENT_CENTOS_VERSION=$(grep -oP '(?<= )[0-9]+(?=\.?)' /etc/redhat-release)
# Check if CentOS version is supported if [[ $CURRENT_CENTOS_VERSION -eq 7 ]]; then
if [[ $CURRENT_CENTOS_VERSION -lt $SUPPORTED_CENTOS_VERSION ]]; then printf " %b CentOS 7 requires EPEL Repository.\\n" "${INFO}"
printf " %b CentOS %s is not supported.\\n" "${CROSS}" "${CURRENT_CENTOS_VERSION}"
printf " Please update to CentOS release %s or later.\\n" "${SUPPORTED_CENTOS_VERSION}"
# exit the installer
exit
fi
# CentOS requires the EPEL repository to gain access to Fedora packages
#TODO : help from @bcambl
EPEL_PKG="epel-release" EPEL_PKG="epel-release"
rpm -q ${EPEL_PKG} &> /dev/null || rc=$? rpm -q ${EPEL_PKG} &> /dev/null || rc=$?
if [[ $rc -ne 0 ]]; then if [[ $rc -ne 0 ]]; then
@@ -376,9 +367,9 @@ elif is_command rpm ; then
"${PKG_INSTALL[@]}" ${EPEL_PKG} &> /dev/null "${PKG_INSTALL[@]}" ${EPEL_PKG} &> /dev/null
printf " %b Installed %s\\n" "${TICK}" "${EPEL_PKG}" printf " %b Installed %s\\n" "${TICK}" "${EPEL_PKG}"
fi fi
fi
else else
# Warn user of unsupported version of Fedora or CentOS # Warn user of unsupported version of Fedora or CentOS but allow advanced users to manually continue via whiptail prompt.
#TODO: probably need help from @bcambl!
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 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
printf " %b Aborting installation due to unsupported RPM based distribution\\n" "${CROSS}" printf " %b Aborting installation due to unsupported RPM based distribution\\n" "${CROSS}"
exit # exit the installer exit # exit the installer