summaryrefslogtreecommitdiffstats
path: root/autoscripts/postrm-nss
blob: da94344f73d5f93f1bf74b0ec5f0e1d938f3d6bf (plain)
1
2
3
4
5
6
7
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