[Pkg-sysvinit-devel] Bug#668312: Bug#668312: sysv-rc: hidden dotfile in /etc used as state file (/etc/init.d/.legacy-bootordering)
Roger Leigh
rleigh at codelibre.net
Fri Apr 20 21:46:00 UTC 2012
tags 668312 + pending
thanks
On Fri, Apr 20, 2012 at 10:06:42PM +0200, Petter Reinholdtsen wrote:
>
> [Roger Leigh]
> > I don't see any other use of this file in any other packages such
> > as file-rc, so the comment in the postrm is probably not needed.
>
> Actually, I suspect that file and related code is some leftover code, as
> I have vague memories of switching to using the existence of S* symlinks
> in one of rc0.d or rc6.d to indicate that legacy boot ordering was in
> effect.
>
> But I might be wrong, as this happened a long time ago.
>From what I can see, it checks for S* symlinks, and then creates
.legacy-bootordering if it exists. The check in the prerm looked
bogus--it created the file before doing the reversion, so it wasn't
actually providing any real safety. I've made a shell function
to do the S* check, and used that in both places.
I hope this is OK with you.
Regards,
Roger
commit e263a1c5fd84f5c2ae7d956a6f0ebc7f3ba628f6
Author: Roger Leigh <rleigh at debian.org>
Date: Fri Apr 20 22:42:41 2012 +0100
debian: Remove use of .legacy-bootordering and close #668312
diff --git a/debian/changelog b/debian/changelog
index 009beba..f69acec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,7 @@ sysvinit (2.88dsf-23) experimental; urgency=low
for wheezy.
- Migrate users of obsolete static boot ordering to dynamic boot
ordering.
+ - Remove use of /etc/init.d/.legacy-bootordering. Closes: #668312.
- Improve help text of debconf message when it is not possible to
automatically enable dynamic boot ordering. Provide explicit
instructions for how to purge obsolete init scripts.
@@ -111,7 +112,7 @@ sysvinit (2.88dsf-23) experimental; urgency=low
- Don't restart or perform initctl migration if systemd is
running.
- -- Roger Leigh <rleigh at debian.org> Thu, 19 Apr 2012 20:26:41 +0100
+ -- Roger Leigh <rleigh at debian.org> Fri, 20 Apr 2012 22:37:35 +0100
sysvinit (2.88dsf-22.1) unstable; urgency=low
diff --git a/debian/sysv-rc.postinst b/debian/sysv-rc.postinst
index 858ef20..62498f2 100644
--- a/debian/sysv-rc.postinst
+++ b/debian/sysv-rc.postinst
@@ -8,7 +8,6 @@ db_version 2.0
now=`date +%Y%m%dT%H%M`
logdir=/var/lib/insserv
logfile="$logdir/run-$now.log"
-flagfile=/etc/init.d/.legacy-bootordering
# Make sure insserv is in path
PATH=/sbin:$PATH
@@ -63,6 +62,16 @@ add_suggestion() {
fi
}
+legacy_bootordering() {
+ for f in /etc/rc0.d/S* ; do
+ if [ -f $f ] ; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
is_unsafe_to_activate() {
retval=1
# Refuse to convert when there are obsolete init.d scripts left
@@ -155,19 +164,11 @@ try_to_convert() {
case "$1" in
configure)
- # Detect migrations away from file-rc, where the legacy boot
- # ordering is used but the flag file to indicated legacy boot
- # ordering is missing. Can not do this in preinst, as preinst
- # might be executed before the postinst of file-rc creatingthe
- # files in /etc/rc?.d/.
- for f in /etc/rc0.d/S* ; do
- if [ ! -f $flagfile ] && [ -f $f ] ; then
- touch $flagfile
- break
- fi
- done
+ if dpkg --compare-versions "$2" lt "2.88dsf-23"
+ rm -f /etc/init.d/.legacy-bootordering
+ fi
- if [ -f $flagfile ] ; then
+ if legacy_bootordering ; then
# Still using legacy ordering, try to convert
if try_to_convert ; then
:
diff --git a/debian/sysv-rc.postrm b/debian/sysv-rc.postrm
index 036e492..e0335ef 100755
--- a/debian/sysv-rc.postrm
+++ b/debian/sysv-rc.postrm
@@ -29,9 +29,6 @@ if [ ! -e /usr/sbin/invoke-rc.d ] ; then
ln -sf /usr/share/sysvinit/update-rc.d /usr/sbin/invoke-rc.d
fi
-# Do not remove /etc/init.d/.legacy-bootordering, to allow those
-# taking over to know where to continue.
-
#DEBHELPER#
# Remove the recorded update-rc.d
diff --git a/debian/sysv-rc.prerm b/debian/sysv-rc.prerm
index 9d6f41a..efba30e 100755
--- a/debian/sysv-rc.prerm
+++ b/debian/sysv-rc.prerm
@@ -5,6 +5,16 @@
set -e
+legacy_bootordering() {
+ for f in /etc/rc0.d/S* ; do
+ if [ -f $f ] ; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
revert_to_legacy_ordering() {
# First, check that we have all the needed actions recorded
present=""
@@ -70,7 +80,6 @@ EOF
# Enable legacy boot ordering, remove all start and stop symlinks,
# and register all scripts again.
echo "warning: reverting to legacy boot ordering"
- touch /etc/init.d/.legacy-bootordering
for script in $present ; do
rm /etc/rc?.d/[KS][0-9][0-9]$script
sh /var/lib/update-rc.d/$script > /dev/null
@@ -88,7 +97,9 @@ case "$1" in
remove)
# Refuse to be uninstalled unless all the needed
# update-rc.d calls are recorded already.
- if [ ! -f /etc/init.d/.legacy-bootordering ] ; then
+ if legacy_bootordering ; then
+ :
+ else
revert_to_legacy_ordering
exit $?
fi
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' schroot and sbuild http://alioth.debian.org/projects/buildd-tools
`- GPG Public Key F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
More information about the Pkg-sysvinit-devel
mailing list