debian: Close #663009, #699523 and #699566
Remove the use of pidof by not restarting init on Hurd. Also
avoid restarts in chroots where ischroot fails.
Roger Leigh
11 years ago
|
0 |
sysvinit (2.88dsf-40) unstable; urgency=low
|
|
1 |
|
|
2 |
[ Roger Leigh ]:
|
|
3 |
* Don't restart init on GNU/Hurd (Closes: #663009).
|
|
4 |
* Handle PID detection more robustly, to work better with containers
|
|
5 |
(Closes: #699523). Always use PID1, which avoids the need for
|
|
6 |
fragile pidof usage.
|
|
7 |
* Handle ischroot more gracefully on failure (Closes: #699566).
|
|
8 |
|
|
9 |
-- Roger Leigh <rleigh@debian.org> Sun, 03 Feb 2013 14:52:05 +0000
|
|
10 |
|
0 | 11 |
sysvinit (2.88dsf-39) unstable; urgency=low
|
1 | 12 |
|
2 | 13 |
[ Roger Leigh ]:
|
16 | 16 |
;;
|
17 | 17 |
esac
|
18 | 18 |
|
19 | |
# PID of init; may not always be 1. Use for sending signals
|
20 | |
# and checking if init is running.
|
21 | |
PID="$(pidof /sbin/init || echo 1)"
|
|
19 |
# PID of init; may not always be 1 but this code isn't run in
|
|
20 |
# these cases (Hurd). Use for sending signals and checking if
|
|
21 |
# init is running.
|
|
22 |
PID=1
|
22 | 23 |
|
23 | 24 |
# Create /run/initctl if not present, and also create compatibility
|
24 | 25 |
# symlinks
|
|
35 | 36 |
mv "$OLDINITCTL.new" "$OLDINITCTL"
|
36 | 37 |
|
37 | 38 |
# Reopen control channel (uses new channel).
|
38 | |
if ! ischroot
|
39 | |
then
|
40 | |
kill -s USR1 "$PID"
|
41 | |
fi
|
|
39 |
kill -s USR1 "$PID"
|
42 | 40 |
rm -f /etc/ioctl.save
|
43 | 41 |
|
44 | 42 |
if [ ! -f /etc/inittab ]
|
|
49 | 47 |
# Tell init to re-exec itself. We loop on failure to reduce
|
50 | 48 |
# the chance of a race before the new control channel is
|
51 | 49 |
# opened.
|
52 | |
if ! ischroot
|
53 | |
then
|
54 | |
echo -n "sysvinit: restarting..."
|
55 | |
for delay in 0 1 2 3 4 5 6 fail;
|
56 | |
do
|
57 | |
if init u
|
|
50 |
echo -n "sysvinit: restarting..."
|
|
51 |
for delay in 0 1 2 3 4 5 6 fail;
|
|
52 |
do
|
|
53 |
if init u
|
|
54 |
then
|
|
55 |
echo " done."
|
|
56 |
break
|
|
57 |
else
|
|
58 |
if [ "$delay" = "fail" ]
|
58 | 59 |
then
|
59 | |
echo " done."
|
60 | |
break
|
|
60 |
echo " failed."
|
61 | 61 |
else
|
62 | |
if [ "$delay" = "fail" ]
|
63 | |
then
|
64 | |
echo " failed."
|
65 | |
else
|
66 | |
echo -n "."
|
67 | |
sleep "$delay"
|
68 | |
fi
|
|
62 |
echo -n "."
|
|
63 |
sleep "$delay"
|
69 | 64 |
fi
|
70 | |
done
|
71 | |
else
|
72 | |
echo "Not restarting sysvinit: chroot detected"
|
73 | |
fi
|
|
65 |
fi
|
|
66 |
done
|
74 | 67 |
|
75 | 68 |
# Remove old pipe if present. No longer in use after re-exec.
|
76 | 69 |
if [ -p "$OLDINITCTL" ]
|
|
90 | 83 |
|
91 | 84 |
umask 022
|
92 | 85 |
|
|
86 |
restart=yes
|
|
87 |
|
|
88 |
chroot=0
|
|
89 |
ischroot || chroot="$?"
|
|
90 |
|
|
91 |
if [ "$chroot" != "1" ]; then
|
|
92 |
restart=no
|
|
93 |
fi
|
|
94 |
|
93 | 95 |
# If systemd is running, don't restart init or doing any initctl
|
94 | 96 |
# migration.
|
95 | |
if [ ! -e /sys/fs/cgroup/systemd ] ; then
|
|
97 |
if [ -e /sys/fs/cgroup/systemd ]; then
|
|
98 |
restart=no
|
|
99 |
fi
|
|
100 |
if [ "$(uname -s)" = "GNU" ]; then
|
|
101 |
restart=no
|
|
102 |
fi
|
|
103 |
|
|
104 |
if [ "$restart" = "yes" ]; then
|
96 | 105 |
do_restart
|
|
106 |
else
|
|
107 |
echo "Not restarting sysvinit"
|
97 | 108 |
fi
|
98 | 109 |
|
99 | 110 |
#DEBHELPER#
|