This file is indexed.

postinst is in daemontools-run 1:0.76-6.1.

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
set -e

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

# workaround #767933
# copy from sysvinit-2.88dsf/debian/sysvinit-core.postinst and adjust
if [ ! -f /etc/inittab ]
then
        cp -p /usr/share/daemontools-run/inittab /etc/inittab
fi
# end copy from sysvinit-2.88dsf

if test -z "$2" || dpkg --compare-versions "$2" lt '1:0.76'; then
  test -n "$(ls -1 /etc/service/)" ||
    for i in /var/service /service /var/lib/svscan; do
      test -d $i || continue
      test -n "$(ls -1 $i)" || continue
      echo "Found directory $i, copying content to /etc/service/..."
      cp -a $i/* /etc/service/
      echo "Moving $i to $i{old} and creating compatibility symlink..."
      rm -rf $i'{old}'
      mv $i $i'{old}'
      ln -s /etc/service $i
      break
    done
  # upgrade from unofficial daemontools-run
  if grep -q '#-- daemontools-run begin' /etc/inittab; then
    echo 'Removing SV inittab entry...'
    rm -f /etc/inittab'{new}'
    sed -e '/#-- daemontools-run begin/,/#-- daemontools-run end/d' \
      /etc/inittab > /etc/inittab'{new}'
    mv -f /etc/inittab'{new}' /etc/inittab
    kill -s HUP 1
    sleep 1
  fi
  # update from daemontools-installer
  if grep -q 'SV:123456:respawn:/command/svscanboot' /etc/inittab; then
    echo 'Removing SV inittab entry...'
    rm -f /etc/inittab'{new}'
    sed -e '/SV:123456:respawn:\/command\/svscanboot/d' \
      /etc/inittab > /etc/inittab'{new}'
    mv -f /etc/inittab'{new}' /etc/inittab
    kill -s HUP 1
    sleep 1
  fi
  # update from daemontools-installer (fhs version)
  if grep -q 'SV:123456:respawn:/usr/bin/svscanboot' /etc/inittab; then
    echo 'Removing SV inittab entry...'
    rm -f /etc/inittab'{new}'
    sed -e '/SV:123456:respawn:\/usr\/bin\/svscanboot/d' \
      /etc/inittab > /etc/inittab'{new}'
    mv -f /etc/inittab'{new}' /etc/inittab
    kill -s HUP 1
    sleep 1
  fi
fi
if test -z "$2"; then
  # not upgrading
  if grep '^SV:' /etc/inittab >/dev/null; then
    cat <<-\EOT >&2
	
	There already is an SV entry in /etc/inittab.  In order to have this
	package add an entry with the name SV to have daemontools' service
	supervision started through sysvinit, you need to remove or rename
	the current SV entry first.
	
	Installation failed.
	
	EOT
    exit 1
  fi
fi
if ! grep '^SV:' /etc/inittab >/dev/null; then
  echo 'Adding SV inittab entry...'
  cp /etc/inittab /etc/inittab'{new}'
  cat >>/etc/inittab'{new}' <<-\EOT
	#-- daemontools-run begin
	SV:123456:respawn:/usr/bin/svscanboot
	#-- daemontools-run end
	EOT
  mv -f /etc/inittab'{new}' /etc/inittab
  kill -s HUP 1
fi

# systemd service
test -h /etc/systemd/system/multi-user.target.wants/daemontools.service ||
  test ! -d /etc/systemd/system/multi-user.target.wants ||
    ln -s /lib/systemd/system/daemontools.service \
      /etc/systemd/system/multi-user.target.wants/
test ! -d /run/systemd/system || systemctl start daemontools.service