From 29f6474496228d534b6514b0c0b46778a95836f4 Mon Sep 17 00:00:00 2001 From: UmaShankar Avagadda Date: Thu, 2 May 2024 13:05:21 +0530 Subject: [PATCH] ZCS-13984 : Changes for RHEL9 (#267) * ZCS-13984:Changes for RHEL9 * ZCS-13984:Changes for RHEL9 * ZCS-13984:Use SHA-256 GPG Key for RHEL9 * ZCS-14464:Install p7zip-plugins from EPEL repo (#270) --- rpmconf/Build/get_plat_tag.sh | 20 +++++ rpmconf/Install/Util/modules/packages.sh | 1 + rpmconf/Install/Util/utilfunc.sh | 96 +++++++++++++++++++++++- rpmconf/Spec/zimbra-imapd.spec | 5 ++ rpmconf/Spec/zimbra-spell.spec | 5 ++ rpmconf/Spec/zimbra-store.spec | 5 ++ 6 files changed, 128 insertions(+), 4 deletions(-) diff --git a/rpmconf/Build/get_plat_tag.sh b/rpmconf/Build/get_plat_tag.sh index 419291bc48..8e99b7c032 100755 --- a/rpmconf/Build/get_plat_tag.sh +++ b/rpmconf/Build/get_plat_tag.sh @@ -25,6 +25,11 @@ if [ -f /etc/redhat-release ]; then i="" fi + grep "Red Hat Enterprise Linux.*release 9" /etc/redhat-release > /dev/null 2>&1 + if [ $? = 0 ]; then + echo "RHEL9${i}" + exit 0 + fi grep "Red Hat Enterprise Linux.*release 8" /etc/redhat-release > /dev/null 2>&1 if [ $? = 0 ]; then echo "RHEL8${i}" @@ -41,6 +46,11 @@ if [ -f /etc/redhat-release ]; then exit 0 fi + grep "CentOS Linux release 9" /etc/redhat-release > /dev/null 2>&1 + if [ $? = 0 ]; then + echo "RHEL9${i}" + exit 0 + fi grep "CentOS Linux release 8" /etc/redhat-release > /dev/null 2>&1 if [ $? = 0 ]; then echo "RHEL8${i}" @@ -57,12 +67,22 @@ if [ -f /etc/redhat-release ]; then exit 0 fi + grep "Rocky Linux release 9" /etc/redhat-release > /dev/null 2>&1 + if [ $? = 0 ]; then + echo "RHEL9${i}" + exit 0 + fi grep "Rocky Linux release 8" /etc/redhat-release > /dev/null 2>&1 if [ $? = 0 ]; then echo "RHEL8${i}" exit 0 fi + grep "Scientific Linux release 9" /etc/redhat-release > /dev/null 2>&1 + if [ $? = 0 ]; then + echo "RHEL9${i}" + exit 0 + fi grep "Scientific Linux release 8" /etc/redhat-release > /dev/null 2>&1 if [ $? = 0 ]; then echo "RHEL8${i}" diff --git a/rpmconf/Install/Util/modules/packages.sh b/rpmconf/Install/Util/modules/packages.sh index c7f05eb5d0..0b93b1f3b6 100755 --- a/rpmconf/Install/Util/modules/packages.sh +++ b/rpmconf/Install/Util/modules/packages.sh @@ -143,6 +143,7 @@ installPackages() { fi removeExistingInstall + installEPELRepo if [ "${#repo_pkg_names[@]}" -gt 0 ] then diff --git a/rpmconf/Install/Util/utilfunc.sh b/rpmconf/Install/Util/utilfunc.sh index 192f9ab984..5a2f32db3b 100755 --- a/rpmconf/Install/Util/utilfunc.sh +++ b/rpmconf/Install/Util/utilfunc.sh @@ -1903,7 +1903,7 @@ removeExistingInstall() { if [ $? = 0 ]; then echo -n "Cleaning up /etc/rsyslog.conf..." sed -i -e '/zimbra/d' /etc/rsyslog.conf - if [ $PLATFORM = "RHEL6_64" -o $PLATFORM = "RHEL7_64" -o $PLATFORM = "RHEL8_64" ]; then + if [ $PLATFORM = "RHEL6_64" -o $PLATFORM = "RHEL7_64" -o $PLATFORM = "RHEL8_64" -o $PLATFORM = "RHEL9_64" ]; then sed -i -e 's/^*.info;local0.none;local1.none;mail.none;auth.none/*.info/' /etc/rsyslog.conf sed -i -e 's/^*.info;local0.none;local1.none;auth.none/*.info/' /etc/rsyslog.conf fi @@ -2211,14 +2211,24 @@ fi repo="rhel7" elif [ $PLATFORM = "RHEL8_64" ]; then repo="rhel8" + elif [ $PLATFORM = "RHEL9_64" ]; then + repo="rhel9" else print "Aborting, unknown platform: $PLATFORM" exit 1 fi - rpm -q gpg-pubkey-0f30c305-5564be70 > /dev/null + if [ $PLATFORM = "RHEL9_64" ]; then + rpm -q gpg-pubkey-7c66bd84-6583eafa > /dev/null + else + rpm -q gpg-pubkey-0f30c305-5564be70 > /dev/null + fi if [ $? -ne 0 ]; then echo "Importing Zimbra GPG key" - rpm --import https://files.zimbra.com/downloads/security/public.key >>$LOGFILE 2>&1 + if [ $PLATFORM = "RHEL9_64" ]; then + rpm --import https://files.zimbra.com/downloads/security/public-sha-256.key >>$LOGFILE 2>&1 + else + rpm --import https://files.zimbra.com/downloads/security/public.key >>$LOGFILE 2>&1 + fi if [ $? -ne 0 ]; then echo "ERROR: Unable to retrive Zimbra GPG key for package validation" echo "Please fix system to allow normal package installation before proceeding" @@ -2497,6 +2507,7 @@ getInstallPackages() { if [ x"$ZMTYPE_INSTALLABLE" = "xNETWORK" ]; then selectChatVideo fi + isp7zipRequired checkRequiredSpace isInstalled zimbra-store @@ -2515,6 +2526,83 @@ getInstallPackages() { done } +isp7zipRequired() { + P7ZIPREQUIRED=no + if [[ $MTA_SELECTED == "yes" && $PLATFORM = "RHEL9_64" ]]; then + isInstalled p7zip-plugins + if [ x$PKGINSTALLED = "x" ]; then + askYN "Install p7zip-plugins from epel-release repository (without p7zip-plugins, some decoders for Amavis may not be available)." "Y" + if [ $response = "yes" ]; then + P7ZIPREQUIRED=yes + fi + fi + fi +} + +installEPELRepo() { + if [ $P7ZIPREQUIRED = "yes" ]; then + OS_NAME=`grep -E '^(NAME)=' /etc/os-release | cut -d = -f 2 | tr -d '"'` + case "$OS_NAME" in + "Red Hat"*) + isInstalled epel-release-latest-9 + if [ x$PKGINSTALLED = "x" ]; then + echo -n "Installing epel-release-latest-9..." + if ! yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y >>$LOGFILE 2>&1 ; then + echo "failed to install epel-release." + exit 1 + else + echo "done." + fi + fi + echo -n "Installing p7zip-plugins..." + if ! yum install p7zip-plugins --enablerepo=epel -y >>$LOGFILE 2>&1 ; then + echo "failed to install p7zip-plugins." + exit 1 + else + echo "done." + fi + ;; + "Oracle"*) + isInstalled oracle-epel-release-el9 + if [ x$PKGINSTALLED = "x" ]; then + echo -n "Installing oracle-epel-release-el9..." + if ! yum install oracle-epel-release-el9 -y >>$LOGFILE 2>&1 ; then + echo "failed to install epel-release." + exit 1 + else + echo "done." + fi + fi + echo -n "Installing p7zip-plugins..." + if ! yum install p7zip-plugins --enablerepo=ol9_developer_EPEL -y >>$LOGFILE 2>&1 ; then + echo "failed to install p7zip-plugins." + exit 1 + else + echo "done." + fi + ;; + "Rocky"*|"CentOS"*) + isInstalled epel-release + if [ x$PKGINSTALLED = "x" ]; then + echo -n "Installing epel-release..." + if ! yum install epel-release -y > /dev/null >>$LOGFILE 2>&1 ; then + echo "failed to install epel-release." + exit 1 + else + echo "done." + fi + fi + echo -n "Installing p7zip-plugins..." + if ! yum install p7zip-plugins --enablerepo=epel -y >>$LOGFILE 2>&1; then + echo "failed to install p7zip-plugins." + exit 1 + else + echo "done." + fi + ;; + esac + fi +} selectChatVideo() { # install chat-video extension and chat-video classic, modern zimlets if [ $STORE_SELECTED = "yes" ] ; then @@ -2905,7 +2993,7 @@ getPlatformVars() { if [ $PLATFORM = "RHEL6_64" ]; then STORE_PACKAGES="libreoffice libreoffice-headless" fi - if [ $PLATFORM = "RHEL7_64" -o $PLATFORM = "RHEL8_64" ]; then + if [ $PLATFORM = "RHEL7_64" -o $PLATFORM = "RHEL8_64" -o $PLATFORM = "RHEL9_64" ]; then STORE_PACKAGES="libreoffice libreoffice-core" fi DumpFileDetailsFromPackage() { diff --git a/rpmconf/Spec/zimbra-imapd.spec b/rpmconf/Spec/zimbra-imapd.spec index d75a6c0cf8..324c9f5063 100644 --- a/rpmconf/Spec/zimbra-imapd.spec +++ b/rpmconf/Spec/zimbra-imapd.spec @@ -19,6 +19,11 @@ Best email money can buy %define __spec_install_pre /bin/true +%if 0%{?rhel} == 9 +%define __brp_ldconfig RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-ldconfig +%define __brp_mangle_shebangs RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-mangle-shebangs +%endif + %prep %build diff --git a/rpmconf/Spec/zimbra-spell.spec b/rpmconf/Spec/zimbra-spell.spec index fecbac60c9..ef95ce59b8 100644 --- a/rpmconf/Spec/zimbra-spell.spec +++ b/rpmconf/Spec/zimbra-spell.spec @@ -19,6 +19,11 @@ Best email money can buy %define __spec_install_pre /bin/true +%if 0%{?rhel} == 9 +%define __brp_ldconfig RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-ldconfig +%define __brp_mangle_shebangs RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-mangle-shebangs +%endif + %prep %build diff --git a/rpmconf/Spec/zimbra-store.spec b/rpmconf/Spec/zimbra-store.spec index fecd4f9a77..f81184ab7f 100644 --- a/rpmconf/Spec/zimbra-store.spec +++ b/rpmconf/Spec/zimbra-store.spec @@ -19,6 +19,11 @@ Best email money can buy %define __spec_install_pre /bin/true +%if 0%{?rhel} == 9 +%define __brp_ldconfig RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-ldconfig +%define __brp_mangle_shebangs RPM_BUILD_ROOT="" /usr/lib/rpm/redhat/brp-mangle-shebangs +%endif + %prep %build