diff options
author | Dave Olson <olson@cumulusnetworks.com> | 2017-06-15 12:47:29 -0700 |
---|---|---|
committer | Dave Olson <olson@cumulusnetworks.com> | 2017-06-15 19:48:50 -0700 |
commit | e3408e0814517e6ad898c525125cf62aad40d60b (patch) | |
tree | d2e5f6eaca0ae5c2cfbce17024da7415743e0260 /debian/libnss-mapuser.postinst | |
download | libnss-mapuser-e3408e0814517e6ad898c525125cf62aad40d60b.tar.gz libnss-mapuser-e3408e0814517e6ad898c525125cf62aad40d60b.zip |
Initial version of libnss-mapuser package
See README for details
Diffstat (limited to 'debian/libnss-mapuser.postinst')
-rw-r--r-- | debian/libnss-mapuser.postinst | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/libnss-mapuser.postinst b/debian/libnss-mapuser.postinst new file mode 100644 index 0000000..b46e66d --- /dev/null +++ b/debian/libnss-mapuser.postinst @@ -0,0 +1,45 @@ +#!/bin/sh +# postinst script for libnss-mapuser +# +# see: dh_installdeb(1) + +set -e + +case "$1" in + configure) + # Add mapname and user to /etc/nsswitch.conf, since it's necessary + # for this package. uid must be first, and mapname must be last + # so uids for mapped users return the mapped name, and on the name, + # we only want to map if no other matches were found + ( set +e; + rgroup=radius_users + if [ -e "/etc/nsswitch.conf" ]; then + sed -i -e '/ mapname/b' \ + -e '/^passwd/s/[ \t][ \t]*/&mapuid /' \ + -e '/^passwd.*#/s/#.*/ mapname &/' \ + -e '/^passwd[^#]*$/s/$/ mapname &/' \ + /etc/nsswitch.conf + fi + addgroup --quiet $rgroup 2>&1 | grep -v 'already exists' + adduser --quiet --firstuid 1000 --disabled-login --ingroup $rgroup \ + --gecos "radius user" radius_user 2>&1 | grep -v 'already exists' + exit 0 + ) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# needed for install, upgrade, remove, and purge, including aborts +pam-auth-update --package + + +#DEBHELPER# + +exit 0 |