Fix a bug for 6.2

This commit is contained in:
Samson-W 2019-12-19 15:35:29 +08:00
parent cce1204ad5
commit 33588912b3
1 changed files with 6 additions and 4 deletions

View File

@ -16,12 +16,12 @@ HARDENING_LEVEL=3
HARDENING_EXCEPTION=dns
PACKAGES='avahi-daemon libavahi-common-data libavahi-common3 libavahi-core7'
PACKAGES_REDHAT='avahi'
PKGS_PATTERN_REDHAT='avahi'
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 2 ]; then
PACKAGES=$PACKAGES_REDHAT
PACKAGES=$PKGS_PATTERN_REDHAT
fi
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
@ -40,7 +40,7 @@ audit () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 2 ]; then
PACKAGES=$PACKAGES_REDHAT
PACKAGES=$PKGS_PATTERN_REDHAT
fi
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
@ -50,7 +50,9 @@ apply () {
else
crit "$PACKAGE is installed, purging it"
if [ $OS_RELEASE -eq 2 ]; then
yum autoremove $PACKAGE -y
for PKGNAME in $(rpm -qa | grep $PACKAGES); do
yum autoremove $PKGNAME -y
done
else
apt-get purge $PACKAGE -y
apt-get autoremove