#!/bin/sh # UnconfigureScxPAM # # Check if pam is configured with single # configuration file or with configuration # directory. # UnconfigureScxPAM() { if [ -s /etc/pam.conf ]; then UnconfigureScxPAM_file elif [ -d /etc/pam.d ]; then UnconfigureScxPAM_dir fi return 0 } UnconfigureScxPAM_file() { # Configured with single file # # Get all lines except scx configuration # pam_configuration=`grep -v "^[# ]*scx" /etc/pam.conf | grep -v "# The configuration of scx is generated by the scx installer." | grep -v "# End of section generated by the scx installer."` if [ $? -ne 0 ]; then # scx not configured in PAM return 0 fi # # Write it back (to the copy first) # cp -p /etc/pam.conf /etc/pam.conf.tmp echo "$pam_configuration" > /etc/pam.conf.tmp if [ $? -ne 0 ]; then echo "can't write to /etc/pam.conf.tmp" return 1 fi mv /etc/pam.conf.tmp /etc/pam.conf if [ $? -ne 0 ]; then echo "can't replace /etc/pam.conf" return 1 fi } UnconfigureScxPAM_dir() { # Configured with directory if [ -f /etc/pam.d/scx ]; then rm -f /etc/pam.d/scx return 0 fi } RemoveConfigFiles() { if [ -f /etc/opt/microsoft/scx/conf/omiserver.conf -a -f /etc/opt/microsoft/scx/conf/.baseconf/omiserver.backup ]; then diff /etc/opt/microsoft/scx/conf/omiserver.conf /etc/opt/microsoft/scx/conf/.baseconf/omiserver.backup if [ $? -eq 1 ]; then mv /etc/opt/microsoft/scx/conf/omiserver.conf /etc/opt/microsoft/scx/conf/omiserver.conf.pkgsave 2> /dev/null else rm /etc/opt/microsoft/scx/conf/omiserver.conf 2> /dev/null fi else rm /etc/opt/microsoft/scx/conf/omiserver.conf 2> /dev/null || true fi } RemoveAdditionalFiles() { rm -rf /var/opt/microsoft/scx/tmp/* > /dev/null 2>&1 } RemoveConfigFiles rm -f /etc/opt/microsoft/scx/ssl/scx.pem_backup /etc/opt/microsoft/scx/ssl/scx.pem UnconfigureScxPAM RemoveAdditionalFiles exit 0