PREUN
/bin/sh
if [ $1 = 0 ]; then
echo "Removing winbind entries from /etc/nsswitch.conf"
perl -pi -e 's/ winbind//' /etc/nsswitch.conf
/sbin/chkconfig winbind reset
fi
POSTIN
/bin/sh
if [ $1 = 1 ]; then
/sbin/chkconfig winbind on
cp -af /etc/nsswitch.conf /etc/nsswitch.conf.rpmsave
cp -af /etc/nsswitch.conf /etc/nsswitch.conf.rpmtemp
for i in passwd group;do
grep ^$i /etc/nsswitch.conf |grep -v 'winbind' >/dev/null
if [ $? = 0 ];then
echo "Adding a winbind entry to the $i section of /etc/nsswitch.conf"
awk '/^'$i'/ {print $0 " winbind"};!/^'$i'/ {print}' /etc/nsswitch.conf.rpmtemp >/etc/nsswitch.conf;
cp -af /etc/nsswitch.conf /etc/nsswitch.conf.rpmtemp
else
echo "$i entry found in /etc/nsswitch.conf"
fi
done
if [ -f /etc/nsswitch.conf.rpmtemp ];then rm -f /etc/nsswitch.conf.rpmtemp;fi
fi