This file is indexed.

postinst is in dnscache-run 1:1.05-8ubuntu1.

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
#!/bin/sh
set -e

test "$1" = 'configure' || exit 0

if test ! -r /etc/sv/dnscache/seed; then
  rm -rf /etc/sv/dnscache/.'{tmp}'.$$
  dnscache-conf Gdnscache Gdnslog /etc/sv/dnscache/.'{tmp}'.$$
  mv /etc/sv/dnscache/.'{tmp}'.$$/seed /etc/sv/dnscache/seed
  rm -rf /etc/sv/dnscache/.'{tmp}'.$$
fi

if test -e /etc/service/dnscache; then
  echo 'Restarting dnscache service...'
  svc -t /etc/service/dnscache || :
else
  update-service --add /etc/sv/dnscache
fi

test -z "$2" || exit 0

chown Gdnslog:adm /var/log/dnscache
# adapt resolv.conf
! grep 'nameserver 127.0.0.1' /etc/resolv.conf >/dev/null || exit 0
test -e /etc/resolv.conf || exec echo 'nameserver 127.0.0.1' >/etc/resolv.conf
sed -e 's/nameserver /# nameserver /g' /etc/resolv.conf >/etc/resolv.conf'{new}'
echo 'nameserver 127.0.0.1' >>/etc/resolv.conf'{new}'
mv -f /etc/resolv.conf'{new}' /etc/resolv.conf