add an entry in nsswitch.conf and remove on purge for the sudo-ldap package
authorBdale Garbee <bdale@gag.com>
Wed, 11 Jan 2012 21:42:26 +0000 (14:42 -0700)
committerBdale Garbee <bdale@gag.com>
Wed, 11 Jan 2012 21:42:26 +0000 (14:42 -0700)
debian/sudo-ldap.postinst
debian/sudo-ldap.postrm

index c242be1f9c2076d88c5ba364c575d62605e24e98..f07b331764834672b7c377bc05b39b3a15854f58 100644 (file)
@@ -11,6 +11,13 @@ if [ ! -f /etc/sudoers ];then
        echo "WARNING:  /etc/sudoers not present!";
 fi
 
+# modify nsswitch.conf if needed
+NSSWITCH="/etc/nsswitch.conf"
+if [ -z "`grep \"^sudoers:\" $NSSWITCH`" ]
+then
+       echo "sudoers:  files ldap" >> $NSSWITCH
+fi
+
 # handle state directory transition from /var/run/sudo to /var/lib/sudo,
 # moving any existing content over to avoid re-lecturing existing users
 if [ -d "/var/run/sudo" ];then
index 30fb1e89436f23c5675cb552d8c1551291af7eea..15c155bb3190739708b2dec2f4d95b448c2bbc35 100644 (file)
@@ -22,4 +22,10 @@ case "$1" in
   ;;
 esac
 
+# modify nsswitch.conf
+NSSWITCH="/etc/nsswitch.conf"
+if [ -w  $NSSWITCH ] ; then
+       sed -i /^sudoers:/d $NSSWITCH
+fi
+
 #DEBHELPER#