From 136984d9de9590f104988ad24fb5ec6618680f04 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 11 Jan 2012 14:42:26 -0700 Subject: [PATCH] add an entry in nsswitch.conf and remove on purge for the sudo-ldap package --- debian/sudo-ldap.postinst | 7 +++++++ debian/sudo-ldap.postrm | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/debian/sudo-ldap.postinst b/debian/sudo-ldap.postinst index c242be1..f07b331 100644 --- a/debian/sudo-ldap.postinst +++ b/debian/sudo-ldap.postinst @@ -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 diff --git a/debian/sudo-ldap.postrm b/debian/sudo-ldap.postrm index 30fb1e8..15c155b 100644 --- a/debian/sudo-ldap.postrm +++ b/debian/sudo-ldap.postrm @@ -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# -- 2.30.2