summaryrefslogtreecommitdiffstats
path: root/autoscripts
diff options
context:
space:
mode:
Diffstat (limited to 'autoscripts')
-rw-r--r--autoscripts/postinst-nss6
-rw-r--r--autoscripts/postinst-nss-db5
-rw-r--r--autoscripts/postrm-nss8
-rw-r--r--autoscripts/postrm-nss-db6
-rw-r--r--autoscripts/preinst-nss4
5 files changed, 29 insertions, 0 deletions
diff --git a/autoscripts/postinst-nss b/autoscripts/postinst-nss
new file mode 100644
index 0000000..9f67154
--- /dev/null
+++ b/autoscripts/postinst-nss
@@ -0,0 +1,6 @@
+if [ "$1" = "configure" ] && [ -f "${DPKG_ROOT}/etc/nsswitch.conf.nss.${DPKG_MAINTSCRIPT_PACKAGE}-will-install" ] && [ -e "${DPKG_ROOT}/etc/nsswitch.conf" ] ; then
+ if ! grep -q -E #SERVICE_PATTERNS# "${DPKG_ROOT}/etc/nsswitch.conf" ; then
+ #OPERATIONS#
+ fi
+ rm "${DPKG_ROOT}/etc/nsswitch.conf.nss.${DPKG_MAINTSCRIPT_PACKAGE}-will-install"
+fi
diff --git a/autoscripts/postinst-nss-db b/autoscripts/postinst-nss-db
new file mode 100644
index 0000000..3814202
--- /dev/null
+++ b/autoscripts/postinst-nss-db
@@ -0,0 +1,5 @@
+if [ "$1" = "configure" ] && [ -e "${DPKG_ROOT}/etc/nsswitch.conf" ] ; then
+ if ! grep -q -E '^#DB#:' "${DPKG_ROOT}/etc/nsswitch.conf" ; then
+ echo "#DB#: " >> "${DPKG_ROOT}/etc/nsswitch.conf"
+ fi
+fi
diff --git a/autoscripts/postrm-nss b/autoscripts/postrm-nss
new file mode 100644
index 0000000..da94344
--- /dev/null
+++ b/autoscripts/postrm-nss
@@ -0,0 +1,8 @@
+: "${DPKG_MAINTSCRIPT_PACKAGE_INSTCOUNT:=$(dpkg-query -f '${db:Status-Abbrev}\n' -W "$DPKG_MAINTSCRIPT_PACKAGE" | grep -c '^i')}"
+if { [ "$1" = "remove" ] || [ "$1" = "purge" ] ; } && [ -e "${DPKG_ROOT}/etc/nsswitch.conf" ] && [ "$DPKG_MAINTSCRIPT_PACKAGE_INSTCOUNT" -eq 0 ] ; then
+ sed -E -i "${DPKG_ROOT}/etc/nsswitch.conf" \
+ -e ':a /^#DB#:\s.*#/ s/(^[^#]+)\s(#SERVICE_NAMES#)\s+\[!?[A-Za-z]+=[A-Za-z]+\](\s|#)/\1\3/g ; t a' \
+ -e ':b /^#DB#:\s.*#/ s/(^[^#]+)\s(#SERVICE_NAMES#)(\s|#)/\1\3/g ; t b' \
+ -e ':c /^#DB#:\s[^#]*$/ s/\s(#SERVICE_NAMES#)\s+\[!?[A-Za-z]+=[A-Za-z]+\](\s|$)/\2/g ; t c' \
+ -e ':d /^#DB#:\s[^#]*$/ s/\s(#SERVICE_NAMES#)(\s|$)/\2/g ; t d'
+fi
diff --git a/autoscripts/postrm-nss-db b/autoscripts/postrm-nss-db
new file mode 100644
index 0000000..c5a9e70
--- /dev/null
+++ b/autoscripts/postrm-nss-db
@@ -0,0 +1,6 @@
+: "${DPKG_MAINTSCRIPT_PACKAGE_INSTCOUNT:=$(dpkg-query -f '${db:Status-Abbrev}\n' -W "$DPKG_MAINTSCRIPT_PACKAGE" | grep -c '^i')}"
+if { [ "$1" = "remove" ] || [ "$1" = "purge" ] ; } && [ -e "${DPKG_ROOT}/etc/nsswitch.conf" ] && [ "$DPKG_MAINTSCRIPT_PACKAGE_INSTCOUNT" -eq 0 ] ; then
+ if grep -q -E '^#DB#:\s*$' "${DPKG_ROOT}/etc/nsswitch.conf" ; then
+ sed -E -i "${DPKG_ROOT}/etc/nsswitch.conf" -e '/^#DB#:/d'
+ fi
+fi
diff --git a/autoscripts/preinst-nss b/autoscripts/preinst-nss
new file mode 100644
index 0000000..a21bc7a
--- /dev/null
+++ b/autoscripts/preinst-nss
@@ -0,0 +1,4 @@
+if [ "$1" = install ]; then
+ # Signal to postinst that the NSS services should be installed, even if the package has been removed but not purged.
+ touch "${DPKG_ROOT}/etc/nsswitch.conf.nss.${DPKG_MAINTSCRIPT_PACKAGE}-will-install"
+fi