@@ -44,18 +44,16 @@ function exit_with_failure() {
4444}
4545
4646function install_pkg() {
47- dpkg -s $1 >> ${INSTALL_LOG} 2>&1
48-
49- if [ $? -ne 0 ]; then
47+ if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1
48+ then
5049 echo " Installing $1 using apt-get"
5150 apt-get install $1 -y >> ${INSTALL_LOG} 2>&1
5251 fi
5352}
5453
5554function remove_pkg() {
56- dpkg -s $1 >> ${INSTALL_LOG} 2>&1
57-
58- if [ $? -eq 0 ]; then
55+ if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1
56+ then
5957 echo " Uninstalling $1 using apt-get"
6058 apt-get remove $1 -y >> ${INSTALL_LOG} 2>&1
6159 fi
@@ -68,6 +66,10 @@ function detect_operating_system() {
6866 echo -e " \ntest -f /etc/debian_version" >> ${INSTALL_LOG}
6967 echo " Debian/Ubuntu"
7068 OPERATING_SYSTEM=" DEBIAN"
69+ elif [ -f /etc/rocky-release ]; then
70+ echo -e " \ntest -f /etc/rocky-release" >> ${INSTALL_LOG}
71+ echo " Rocky Linux"
72+ OPERATING_SYSTEM=" ROCKY"
7173 elif [ -f /etc/redhat-release ] || [ -f /etc/system-release-cpe ]; then
7274 echo -e " \ntest -f /etc/redhat-release || test -f /etc/system-release-cpe" >> ${INSTALL_LOG}
7375 echo " RedHat/CentOS"
@@ -90,12 +92,11 @@ function detect_operating_system() {
9092}
9193
9294function install_python() {
93-
9495 if [ $OPERATING_SYSTEM == " DEBIAN" ]; then
9596 echo " Installing Python using apt-get"
9697 apt-get update >> ${INSTALL_LOG} 2>&1
9798 apt-get install python3 -y >> ${INSTALL_LOG} 2>&1
98- elif [ $OPERATING_SYSTEM == " REDHAT" ]; then
99+ elif [ $OPERATING_SYSTEM == " REDHAT" ] || [ $OPERATING_SYSTEM == " ROCKY " ] ; then
99100 echo " Installing Python using yum"
100101 yum install python3 -y >> ${INSTALL_LOG} 2>&1
101102 elif [ $OPERATING_SYSTEM == " openSUSE" ] || [ $OPERATING_SYSTEM == " SLE" ]; then
@@ -122,7 +123,7 @@ function remove_python() {
122123 echo " Uninstalling Python using apt-get"
123124 apt-get remove python3 -y & > ${INSTALL_LOG}
124125 apt-get autoremove -y & > ${INSTALL_LOG}
125- elif [ $OPERATING_SYSTEM == " REDHAT" ]; then
126+ elif [ $OPERATING_SYSTEM == " REDHAT" ] || [ $OPERATING_SYSTEM == " ROCKY " ] ; then
126127 echo " Uninstalling Python using yum"
127128 yum remove python3 -y & > ${INSTALL_LOG}
128129 elif [ $OPERATING_SYSTEM == " openSUSE" ] || [ $OPERATING_SYSTEM == " SLE" ]; then
0 commit comments