Mini Shell
#!/usr/bin/bash
# RPM preun script
# Note: Also called from Debian pam-lve.prerm scriptlet
# Arguments:
# RPM
# "$1" == 0 -- RPM will uninstall package
# "$1" == 1 -- RPM upgrade/downgrade package
# DEB
# "$1" == "remove" - DEB will uninstall package
# "$1" == "upgrade" -- DEB will upgrade/downgrade package
# "pam-lve PRE UNINSTALL STARTED"
# RPM/DEB argument unified interpreter
argument=''
if [[ "$1" == 0 || "$1" == "remove" ]]; then
# "$1" == 0 -- RPM will uninstall package
# "$1" == "remove" - DEB will uninstall package
argument='uninstall'
elif [[ "$1" == 1 || "$1" == "upgrade" ]]; then
# "$1" == 1 -- RPM upgrade/downgrade package
# "$1" == "upgrade" -- DEB
argument='upgrade'
else
# Unknown argument (some special cases only for DEB. See alt-python27-cllib.prerm scriptlet for details),
# skip all actions
exit 0
fi;
if [ "$argument" == 'uninstall' ]; then
if [ -e "/etc/pam.d/sudo" ]; then
sed -i '/pam_sulve.so/d' /etc/pam.d/sudo
fi
if [ -e "/etc/pam.d/sshd" ]; then
sed -i '/pam_lve.so/d' /etc/pam.d/sshd
fi
if [ -e "/etc/pam.d/su" ]; then
sed -i '/pam_lve.so/d' /etc/pam.d/su
sed -i '/pam_sulve.so/d' /etc/pam.d/su
fi
# PAM config for cron
pam_d_cron_file=''
if [ -e "/etc/pam.d/crond" ]; then
# Cloudlinux
pam_d_cron_file='/etc/pam.d/crond'
fi
if [ -e "/etc/pam.d/cron" ]; then
# Ubuntu
pam_d_cron_file='/etc/pam.d/cron'
fi
if [[ -n "$pam_d_cron_file" && -e "$pam_d_cron_file" ]]; then
sed -i '/pam_lve.so/d' "$pam_d_cron_file"
fi
fi
# "pam-lve PRE UNINSTALL FINISHED"
exit 0
Zerion Mini Shell 1.0