From 7b3df8350d1fb6a423b7dc84fb63354724491fa2 Mon Sep 17 00:00:00 2001 From: Amith Kumar Date: Feb 12 2021 08:26:18 +0000 Subject: pcp-daemons: Fix upstream failures One of the testcase failed due to absence of chkconfig and initrc related files. Make existing code compatible with higher versions of Fedora and fix the failures. Signed-off-by: Amith Kumar --- diff --git a/selinux-policy/pcp-daemons-and-similar/runtest.sh b/selinux-policy/pcp-daemons-and-similar/runtest.sh index 0b8321c..9103fda 100755 --- a/selinux-policy/pcp-daemons-and-similar/runtest.sh +++ b/selinux-policy/pcp-daemons-and-similar/runtest.sh @@ -394,12 +394,20 @@ rlJournalStart rlRun "semodule -l | grep pcp" rlRun "echo ${ROOT_PASSWORD} | passwd --stdin root" for SERVICE_NAME in pmcd pmie pmlogger pmproxy ; do - rlRun "chkconfig ${SERVICE_NAME} on" + if rlIsFedora '>=33' || rlIsRHEL ">=8.1" ; then + rlRun "systemctl enable ${SERVICE_NAME}" + else + rlRun "chkconfig ${SERVICE_NAME} on" + fi done for TRIPLET in ${TRIPLETSLIST} ; do - if ! rlSEDefined "${SEDEFINED}" ; then - # for RHELs where the SELinux domain does not exist yet - PROCESS_CONTEXT="initrc_t" + if rlIsFedora '<33' || rlIsRHEL "<8" ; then + if ! rlSEDefined "${SEDEFINED}" ; then + # for RHELs where the SELinux domain does not exist yet + PROCESS_CONTEXT="initrc_t" + else + PROCESS_CONTEXT=`echo ${TRIPLET} | cut -d : -f 3` + fi else PROCESS_CONTEXT=`echo ${TRIPLET} | cut -d : -f 3` fi @@ -411,11 +419,15 @@ rlJournalStart rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status restart status" 1 done for TRIPLET in ${TRIPLETSLIST} ; do - if ! rlSEDefined "${SEDEFINED}" ; then - # for RHELs where the SELinux domain does not exist yet - PROCESS_CONTEXT="initrc_t" + if rlIsFedora '<33' || rlIsRHEL "<8" ; then + if ! rlSEDefined "${SEDEFINED}" ; then + # for RHELs where the SELinux domain does not exist yet + PROCESS_CONTEXT="initrc_t" + else + PROCESS_CONTEXT=`echo ${TRIPLET} | cut -d : -f 3` + fi else - PROCESS_CONTEXT=`echo ${TRIPLET} | cut -d : -f 3` + PROCESS_CONTEXT=`echo ${TRIPLET} | cut -d : -f 3` fi PROCESS_NAME=`echo ${TRIPLET} | cut -d : -f 4` SERVICE_NAME=${PROCESS_NAME} @@ -425,7 +437,11 @@ rlJournalStart rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "stop" 1 done for SERVICE_NAME in pmcd pmie pmlogger pmproxy ; do - rlRun "chkconfig ${SERVICE_NAME} off" + if rlIsFedora '>=33' || rlIsRHEL ">=8.1" ; then + rlRun "systemctl disable ${SERVICE_NAME}" + else + rlRun "chkconfig ${SERVICE_NAME} off" + fi done rlPhaseEnd