~ubuntu-branches/ubuntu/oneiric/daemontools/oneiric

« back to all changes in this revision

Viewing changes to debian/daemontools-run.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Moog
  • Date: 2009-04-27 03:23:53 UTC
  • Revision ID: james.westby@ubuntu.com-20090427032353-eulrn8a5yuf2qy9n
Tags: 1:0.76-3ubuntu1
* debian/control
  - updated description of daemontools-run
* debian/daemontools-run.*
  - updated to use upstart (LP: #253465)
* debian/rules
  - install svscan-file to /etc/event.d
* debian/svscan
  - service-file for upstart

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
set -e
3
3
 
4
 
test "$1" = 'configure' || exit 0
5
 
 
6
4
if test -z "$2" || dpkg --compare-versions "$2" lt '1:0.76'; then
7
5
  test -n "$(ls -1 /etc/service/)" ||
8
6
    for i in /var/service /service /var/lib/svscan; do
16
14
      ln -s /etc/service $i
17
15
      break
18
16
    done
19
 
  # upgrade from unofficial daemontools-run
20
 
  if grep -q '#-- daemontools-run begin' /etc/inittab; then
21
 
    echo 'Removing SV inittab entry...'
22
 
    rm -f /etc/inittab'{new}'
23
 
    sed -e '/#-- daemontools-run begin/,/#-- daemontools-run end/d' \
24
 
      /etc/inittab > /etc/inittab'{new}'
25
 
    mv -f /etc/inittab'{new}' /etc/inittab
26
 
    kill -s HUP 1
27
 
    sleep 1
28
 
  fi
29
 
  # update from daemontools-installer
30
 
  if grep -q 'SV:123456:respawn:/command/svscanboot' /etc/inittab; then
31
 
    echo 'Removing SV inittab entry...'
32
 
    rm -f /etc/inittab'{new}'
33
 
    sed -e '/SV:123456:respawn:\/command\/svscanboot/d' \
34
 
      /etc/inittab > /etc/inittab'{new}'
35
 
    mv -f /etc/inittab'{new}' /etc/inittab
36
 
    kill -s HUP 1
37
 
    sleep 1
38
 
  fi
39
 
  # update from daemontools-installer (fhs version)
40
 
  if grep -q 'SV:123456:respawn:/usr/bin/svscanboot' /etc/inittab; then
41
 
    echo 'Removing SV inittab entry...'
42
 
    rm -f /etc/inittab'{new}'
43
 
    sed -e '/SV:123456:respawn:\/usr\/bin\/svscanboot/d' \
44
 
      /etc/inittab > /etc/inittab'{new}'
45
 
    mv -f /etc/inittab'{new}' /etc/inittab
46
 
    kill -s HUP 1
47
 
    sleep 1
48
 
  fi
49
 
fi
50
 
if test -z "$2"; then
51
 
  # not upgrading
52
 
  if grep '^SV:' /etc/inittab >/dev/null; then
53
 
    cat <<-\EOT >&2
54
 
        
55
 
        There already is an SV entry in /etc/inittab.  In order to have this
56
 
        package add an entry with the name SV to have daemontools' service
57
 
        supervision started through sysvinit, you need to remove or rename
58
 
        the current SV entry first.
59
 
        
60
 
        Installation failed.
61
 
        
62
 
        EOT
63
 
    exit 1
64
 
  fi
65
 
fi
66
 
if ! grep '^SV:' /etc/inittab >/dev/null; then
67
 
  echo 'Adding SV inittab entry...'
68
 
  cp /etc/inittab /etc/inittab'{new}'
69
 
  cat >>/etc/inittab'{new}' <<-\EOT
70
 
        #-- daemontools-run begin
71
 
        SV:123456:respawn:/usr/bin/svscanboot
72
 
        #-- daemontools-run end
73
 
        EOT
74
 
  mv -f /etc/inittab'{new}' /etc/inittab
75
 
  kill -s HUP 1
 
17
fi
 
18
 
 
19
if test -f /etc/event.d/svscan
 
20
 then
 
21
   echo 'Starting svscan-service'
 
22
   /sbin/start svscan
76
23
fi