Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-testing > by-pkgid > 5a17a85b90a04637328fee248c0e1e17 > scriptlet

samba-winbind-3.3.9-0.1mdv2009.1.x86_64.rpm

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