~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Package Import Robot
  • Author(s): Roger Leigh, Roger Leigh, Michael Stapelberg
  • Date: 2012-07-28 20:09:11 UTC
  • mfrom: (9.1.47 sid)
  • Revision ID: package-import@ubuntu.com-20120728200911-1xa3ydm5a46lyrjd
Tags: 2.88dsf-41+jessie1
[ Roger Leigh ]
* initscripts:
  - Move /etc/nologin and /var/lib/initscripts/nologin to
    /run/nologin.  This means that nologin is always created on
    a writable, available filesystem.  Closes: #660862.
  - Remove code to generate /etc/mtab.  /etc/mtab is now always a
    symbolic link to /proc/mounts.  Closes: #630723.
  - Remove incorrect use of break in case blocks in vars.sh.  Thanks
    to Raphaël Hertzog for this patch.  Closes: #701031.
  - /etc/network/if-up.d/mountnfs: Skip lo if already configured.
    Closes: #705052.  Thanks to Timo Weingärtner.
* sysvinit:
  - Document length limit of 127 in inittab process field.  Thanks
    to Johannes Truschnigg.  Closes: #693960.
* sysv-rc:
  - Fix typo in invoke-rc.d(8).  Closes: #683804.  Thanks to
    Martin-Éric Racine.

[ Michael Stapelberg ]
* systemd: update check to look for /run/systemd/system.
  Closes: #703571
* sysv-rc:
  - Add systemd support to update-rc.d(8) and invoke-rc.d(8).
    Closes: #683084.
  - service(8): use systemctl on machines that run systemd.
    Closes: #704923

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
                ;;
18
18
        esac
19
19
 
20
 
        # PID of init; may not always be 1.  Use for sending signals
21
 
        # and checking if init is running.
22
 
        PID="$(pidof /sbin/init || true)"
 
20
        # PID of init; may not always be 1 but this code isn't run in
 
21
        # these cases (Hurd).  Use for sending signals and checking if
 
22
        # init is running.
 
23
        PID=1
23
24
 
24
25
        # Create /run/initctl if not present, and also create compatibility
25
26
        # symlinks
26
 
        if [ "$INITCTL" ] && [ ! -p "$INITCTL" ]
 
27
        if [ ! -p "$INITCTL" ]
27
28
        then
28
29
                # Create new control channel
29
30
                echo "sysvinit: creating $INITCTL"
30
31
                rm -f $INITCTL
31
32
                mkfifo -m 600 $INITCTL
32
 
 
33
 
                # Replace old control channel (if present) with symlink
34
 
                if [ -e "$OLDINITCTL" ]; then
35
 
                        ln -s "$INITCTL" "$OLDINITCTL.new"
36
 
                        mv "$OLDINITCTL.new" "$OLDINITCTL"
37
 
                fi
38
 
 
39
 
                # Reopen control channel (uses new channel).
40
 
                if ! ischroot && [ -n "$PID" ]
 
33
        fi
 
34
 
 
35
        # Replace old control channel with symlink
 
36
        ln -s "$INITCTL" "$OLDINITCTL.new"
 
37
        mv "$OLDINITCTL.new" "$OLDINITCTL"
 
38
 
 
39
        # Reopen control channel (uses new channel).
 
40
        kill -s USR1 "$PID"
 
41
 
 
42
        # Tell init to re-exec itself.  We loop on failure to reduce
 
43
        # the chance of a race before the new control channel is
 
44
        # opened.
 
45
        echo -n "sysvinit: restarting..."
 
46
        for delay in 0 1 2 3 4 5 6 fail;
 
47
        do
 
48
                if init u
41
49
                then
42
 
                        kill -s USR1 "$PID"
43
 
                fi
44
 
        fi
45
 
        rm -f /etc/ioctl.save
46
 
 
47
 
        if [ ! -f /etc/inittab ]
48
 
        then
49
 
                cp -p /usr/share/sysvinit/inittab /etc/inittab
50
 
        fi
51
 
 
52
 
        # Tell init to re-exec itself.  We loop on failure because to reduce
53
 
        # the chance of a race before the new control channel is opened.
54
 
        if ! ischroot && [ -n "$PID" ]
55
 
        then
56
 
                echo -n "sysvinit: restarting..."
57
 
                for delay in 0 1 2 3 4 5 6 fail;
58
 
                do
59
 
                        if init u
 
50
                        echo " done."
 
51
                        break
 
52
                else
 
53
                        if [ "$delay" = "fail" ]
60
54
                        then
61
 
                                echo " done."
62
 
                                break
 
55
                                echo " failed."
63
56
                        else
64
 
                                if [ "$delay" = "fail" ]
65
 
                                then
66
 
                                        echo " failed."
67
 
                                else
68
 
                                        echo -n "."
69
 
                                        sleep "$delay"
70
 
                                fi
 
57
                                echo -n "."
 
58
                                sleep "$delay"
71
59
                        fi
72
 
                done
73
 
        else
74
 
                if [ -n "$PID" ]
75
 
                then
76
 
                        echo "Not restarting sysvinit: chroot detected"
77
 
                else
78
 
                        echo "Not restarting sysvinit: init not running"
79
60
                fi
80
 
        fi
 
61
        done
81
62
 
82
63
        # Remove old pipe if present.  No longer in use after re-exec.
83
 
        if [ "$OLDINITCTL" ] && [ -p "$OLDINITCTL" ]
 
64
        if [ -p "$OLDINITCTL" ]
84
65
        then
85
66
                rm -f "$OLDINITCTL"
86
67
        fi
97
78
 
98
79
umask 022
99
80
 
 
81
rm -f /etc/ioctl.save
 
82
 
 
83
if [ ! -f /etc/inittab ]
 
84
then
 
85
        cp -p /usr/share/sysvinit/inittab /etc/inittab
 
86
fi
 
87
 
 
88
restart=yes
 
89
 
 
90
chroot=0
 
91
ischroot || chroot="$?"
 
92
 
 
93
if [ "$chroot" != "1" ]; then
 
94
        restart=no
 
95
fi
 
96
 
100
97
# If systemd is running, don't restart init or doing any initctl
101
98
# migration.
102
 
if [ ! -e /sys/fs/cgroup/systemd ] ; then
 
99
if [ -d /run/systemd/system ]; then
 
100
        restart=no
 
101
fi
 
102
if [ "$(uname -s)" = "GNU" ]; then
 
103
        restart=no
 
104
fi
 
105
 
 
106
if [ "$restart" = "yes" ]; then
103
107
        do_restart
 
108
else
 
109
        echo "Not restarting sysvinit"
104
110
fi
105
111
 
106
112
#DEBHELPER#