postrm is in libnss-resolve 229-4ubuntu4.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/bin/sh
set -e
# This code was taken from libnss-myhostname
remove_nss_entry() {
refcount=$(dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' \
-W libnss-resolve | grep '^i' | wc -l)
if [ "$refcount" -gt 0 ] ; then
# there are other instances, do nothing
return
fi
echo "Checking NSS setup..."
# abort if /etc/nsswitch.conf does not exist
if ! [ -e /etc/nsswitch.conf ]; then
echo "Could not find /etc/nsswitch.conf."
return
fi
perl -i -pe '
sub remove {
my $s=shift;
$s=~s/\s+\Qresolve\E//g;
return $s;
}
s/^(hosts:)(.*)/$1.remove($2)/e;
' /etc/nsswitch.conf
}
if [ "$1" = remove ]; then
remove_nss_entry
fi
|