adddivert / rmalldivert

bblack at superiorbroadband.com bblack at superiorbroadband.com
Wed Apr 24 22:55:44 CEST 2002


First of all i need to say i love the addition of rmalldivert to 
the latest version of fai.  Makes everyones life much easier.  I 
do have to make one suggestion.

First a little background.  I am trying to modify the fai scripts 
as little as possible so that upgrading fai goes as smoothly as 
possible.  The hook scripts are how i am doing most of my 
adjustments, thats what they are there for.

In my updatebase.DEFAULT hook file i am doing a couple of dpkg/apt 
tweaks i want done before prepare_apt calls $ROOTCMD apt-get update.

Unfortunately this requires me to "adddivert /sbin/start-stop-daemon" 
just like prepare_apt does.  This ends up happening twice, so that 
$divertlist has the same executable in there twice.

When rmalldivert gets called at the end of installation it goes 
through the list and rms /sbin/start-stop-daemon, tells dpkg to 
restore the "real" binary.  Then rmdivert continues through the list 
and comes to /sbin/start-stop-daemon again.  It deletes the restored 
binary, and then tells dpkg to remove the divert which no longer 
exists after the first time.  What we end up with is no 
/sbin/start-stop-daemon which isn't the best place to be if you want 
a functional system.

Currently i have just commented out the same adddivert in 
subroutines-linux.

What i think should happen is either 
1)  Adddivert checks to see if $item already exists in $divertlist
    If it does echo some error message about it already being 
       in $divertlist but do not add it or call mkdivert.
    Something to the effect of
-
adddivert() in /usr/share/fai/subroutines-linux

local item
for item in "$@"; do
    for diverted in `cat $divertlist`; do
        if [ "$item" = "$diverted" ]; then
            echo "$item already diverted"
            exit
        fi
   done
   mkdivert $item
   echo $item >> $divertlist
done
-

2)  rmdivert checks to see if a divert actually exists before it 
      rms the "old" binary which very well could already be the 
      restored original binary.

Bob



More information about the linux-fai mailing list