22 | 22 |
|
23 | 23 |
# Create /run/initctl if not present, and also create compatibility
|
24 | 24 |
# symlinks
|
25 | |
if [ "$INITCTL" ] && [ ! -p "$INITCTL" ]
|
|
25 |
if [ ! -p "$INITCTL" ]
|
26 | 26 |
then
|
27 | 27 |
# Create new control channel
|
28 | 28 |
echo "sysvinit: creating $INITCTL"
|
29 | 29 |
rm -f $INITCTL
|
30 | 30 |
mkfifo -m 600 $INITCTL
|
31 | 31 |
|
32 | |
# Replace old control channel (if present) with symlink
|
33 | |
if [ -e "$OLDINITCTL" ]; then
|
34 | |
ln -s "$INITCTL" "$OLDINITCTL.new"
|
35 | |
mv "$OLDINITCTL.new" "$OLDINITCTL"
|
36 | |
fi
|
|
32 |
# Replace old control channel with symlink
|
|
33 |
ln -s "$INITCTL" "$OLDINITCTL.new"
|
|
34 |
mv "$OLDINITCTL.new" "$OLDINITCTL"
|
37 | 35 |
|
38 | 36 |
# Reopen control channel (uses new channel).
|
39 | |
if ! ischroot && [ -n "$PID" ]
|
|
37 |
if ! ischroot
|
40 | 38 |
then
|
41 | 39 |
kill -s USR1 "$PID"
|
42 | 40 |
fi
|
|
48 | 46 |
cp -p /usr/share/sysvinit/inittab /etc/inittab
|
49 | 47 |
fi
|
50 | 48 |
|
51 | |
# Tell init to re-exec itself. We loop on failure because to reduce
|
52 | |
# the chance of a race before the new control channel is opened.
|
53 | |
if ! ischroot && [ -n "$PID" ]
|
|
49 |
# Tell init to re-exec itself. We loop on failure to reduce
|
|
50 |
# the chance of a race before the new control channel is
|
|
51 |
# opened.
|
|
52 |
if ! ischroot
|
54 | 53 |
then
|
55 | 54 |
echo -n "sysvinit: restarting..."
|
56 | 55 |
for delay in 0 1 2 3 4 5 6 fail;
|
|
70 | 69 |
fi
|
71 | 70 |
done
|
72 | 71 |
else
|
73 | |
if [ -n "$PID" ]
|
74 | |
then
|
75 | |
echo "Not restarting sysvinit: chroot detected"
|
76 | |
else
|
77 | |
echo "Not restarting sysvinit: init not running"
|
78 | |
fi
|
|
72 |
echo "Not restarting sysvinit: chroot detected"
|
79 | 73 |
fi
|
80 | 74 |
|
81 | 75 |
# Remove old pipe if present. No longer in use after re-exec.
|
82 | |
if [ "$OLDINITCTL" ] && [ -p "$OLDINITCTL" ]
|
|
76 |
if [ -p "$OLDINITCTL" ]
|
83 | 77 |
then
|
84 | 78 |
rm -f "$OLDINITCTL"
|
85 | 79 |
fi
|