On Sat, 2010-05-29 at 20:14 +0200, Petter Reinholdtsen wrote: > tags 575080 + patch > thanks > > [Chanoch (Ken) Bloom] > > There's a third option, now that I look more in detail at your other > > maintainer scripts. sysv-rc.preinst touches > > /etc/init.d/.legacy-bootordering on upgrade (under certain > > circumstances), but doesn't create it on install. You add tests to > > create the /etc/init.d/.legacy-bootordering file on install too, > > based on appropriate circumstances. > > Actually, this almost the same as my second approach. I've commited > this patch to svn, which I believe will solve this migration issue. > > Index: debian/sysv-rc.postinst > =================================================================== > --- debian/sysv-rc.postinst (revision 1898) > +++ debian/sysv-rc.postinst (working copy) > @@ -172,6 +172,19 @@ > fi > rm /var/run/sysv-rc.upgrade > fi > + > + # 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 [ -f $flagfile ] ; then > # Still using legacy ordering, try to convert > if try_to_convert ; then
I'd imagine there's several ways to clean up the code here. First you can now eliminate the check to create .legacy-bootordering in preinst. Second, there's no need to check for the absense of the flag file before touching it to create it. Third, you can eliminate the need to create .legacy-bootordering altogether by setting a variable and checking that variable in the if statement. Fourth, why not eliminate the for-loop altogether, and just do something like if ls -d /etc/rc0.d/S* > /dev/null 2>&1; then # Still using legacy ordering, try to convert if try_to_convert ; then #... -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org