[Pkg-sssd-devel] sssd: Changes to 'debian-experimental'
Stéphane Graber
stgraber-guest at alioth.debian.org
Sun Feb 10 18:23:13 UTC 2013
debian/changelog | 6 +++++
debian/libsss-sudo.postinst | 46 ++++++++++++++++++++++++++++++++++++++++++++
debian/libsss-sudo.postrm | 31 +++++++++++++++++++++++++++++
3 files changed, 83 insertions(+)
New commits:
commit aba746bd82a63ff5ac9d6e5b0c7a27924182a594
Author: Stéphane Graber <stgraber at ubuntu.com>
Date: Sun Feb 10 13:22:35 2013 -0500
Add postinst/postrm for libsss-sudo
Add postinst/postrm script for libsss-sudo. Those will add a "sudoers"
entry to /etc/nsswitch.conf upon first installation of the package and
will then take care of adding/removing sss from the stack as required.
diff --git a/debian/changelog b/debian/changelog
index c67dfa8..ac160d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
sssd (1.9.4-1) UNRELEASED; urgency=low
+ [ Timo Aaltonen ]
* New upstream release 1.9.4.
* Update the packaging for the new version, thanks Esko Järnfors!
- Add libsss-idmap0, libsss-idmap-dev packages
@@ -39,6 +40,11 @@ sssd (1.9.4-1) UNRELEASED; urgency=low
* rules: Pass --datadir, so the path in autogenerated python files is
correctly substituted. (LP: #1079938)
+ [ Stéphane Graber ]
+ * Add postinst/postrm script for libsss-sudo. Those will add a "sudoers"
+ entry to /etc/nsswitch.conf upon first installation of the package and
+ will then take care of adding/removing sss from the stack as required.
+
-- Timo Aaltonen <tjaalton at ubuntu.com> Thu, 24 May 2012 14:46:39 +0300
sssd (1.8.4-2) UNRELEASED; urgency=low
diff --git a/debian/libsss-sudo.postinst b/debian/libsss-sudo.postinst
index 64e9cc6..298c758 100644
--- a/debian/libsss-sudo.postinst
+++ b/debian/libsss-sudo.postinst
@@ -18,4 +18,50 @@ esac
#DEBHELPER#
+# This code was taken from libnss-myhostname, which got it from nss-mdns:
+
+log() {
+ echo "$*"
+}
+
+# try to insert sss entries to the passwd, group, shadow and netgroup
+# lines in /etc/nsswitch.conf to automatically enable libnss-sss
+# support; do not change the configuration if the lines already
+# references some sss lookups
+insert_nss_entry() {
+ log "Checking NSS setup..."
+ # abort if /etc/nsswitch.conf does not exist
+ if ! [ -e /etc/nsswitch.conf ]; then
+ log "Could not find /etc/nsswitch.conf."
+ return
+ fi
+
+ if grep -q ^sudoers /etc/nsswitch.conf; then
+ # append 'sss' to the end of the line if it's not found already
+ sed -i --regexp-extended '
+ /^(sudoers):/ {
+ /\bsss\b/! s/$/ sss/
+ }
+ ' /etc/nsswitch.conf
+ else
+ echo "sudoers: files sss" >> /etc/nsswitch.conf
+ fi
+}
+
+action="$1"
+
+if [ configure = "$action" ]; then
+ if [ -z "$2" ]; then
+ log "First installation detected..."
+ # first install: setup the recommended configuration (unless
+ # nsswitch.conf already contains sss entries)
+ insert_nss_entry
+ else
+ # upgrade
+ version="$2"
+
+ # Nothing to do here yet
+ fi
+fi
+
exit 0
diff --git a/debian/libsss-sudo.postrm b/debian/libsss-sudo.postrm
new file mode 100644
index 0000000..aaeb4de
--- /dev/null
+++ b/debian/libsss-sudo.postrm
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+# This code was taken from libnss-myhostname, which got it from nss-mdns:
+
+log() {
+ echo "$*"
+}
+
+remove_nss_entry() {
+ log "Checking NSS setup..."
+ # abort if /etc/nsswitch.conf does not exist
+ if ! [ -e /etc/nsswitch.conf ]; then
+ log "Could not find /etc/nsswitch.conf."
+ return
+ fi
+ sed -i --regexp-extended '
+ /^(sudoers):/ {
+ s/\bsss\b//g
+ s/[[:space:]]+$//
+ }
+ ' /etc/nsswitch.conf
+}
+
+action="$1"
+
+if [ "$action" = remove ]; then
+ remove_nss_entry
+fi
More information about the Pkg-sssd-devel
mailing list