Skip to content

Commit

Permalink
Fix script execution on rocky9 and new RH systems based on systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Sep 19, 2024
1 parent 98b80e8 commit f288420
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions package/usr/bin/pf_ringcfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ DISTRO="unknown"
if [ -f /lib/lsb/init-functions ]; then
DISTRO="debian"
. /lib/lsb/init-functions
fi
if [ -f /etc/init.d/functions ]; then
DISTRO="centos"
elif [ -f /etc/init.d/functions ]; then
DISTRO="rh"
. /etc/init.d/functions
elif [ -e /etc/redhat-release ]; then
DISTRO="rh"
echo_failure() {
echo -n "[FAILURE]"
echo -ne "\r"
}
echo_success() {
echo -n "[ OK ]"
echo -ne "\r"
}
fi

if [[ $EUID -ne 0 ]]; then
Expand All @@ -37,7 +46,7 @@ pfring_installed() {
if [ `dpkg -l | grep pfring-dkms | wc -l` -gt 0 ]; then
return 0
fi
elif [ ${DISTRO} == "centos" ]; then
elif [ ${DISTRO} == "rh" ]; then
if [ `rpm -qa | grep pfring-dkms | wc -l` -gt 0 ]; then
return 0
fi
Expand All @@ -51,7 +60,7 @@ zc_driver_installed() {
if [ `dpkg -l | grep ${MODEL}-zc-dkms | wc -l` -gt 0 ]; then
return 0
fi
elif [ ${DISTRO} == "centos" ]; then
elif [ ${DISTRO} == "rh" ]; then
if [ `rpm -qa | grep ${MODEL}-zc | wc -l` -gt 0 ]; then
return 0
fi
Expand All @@ -64,7 +73,7 @@ install_pfring() {
apt-get clean all
apt-get update
apt-get install pfring-dkms
elif [ ${DISTRO} == "centos" ]; then
elif [ ${DISTRO} == "rh" ]; then
yum clean all
yum update
yum install pfring-dkms
Expand All @@ -78,7 +87,7 @@ install_zc_driver() {
apt-get clean all
apt-get update
apt-get install pfring-dkms ${MODEL}-zc-dkms
elif [ ${DISTRO} == "centos" ]; then
elif [ ${DISTRO} == "rh" ]; then
yum clean all
yum update
yum install pfring-dkms ${MODEL}-zc
Expand Down

0 comments on commit f288420

Please sign in to comment.