Multiple services per interface (Was: Re: Hotplug can bring up/down interfaces now)

Bryan Kadzban bryan at kadzban.is-a-geek.net
Tue Jul 6 19:57:03 PDT 2004


DJ Lucas wrote:
> Okay...hotplug is gone for this release, but what of the work on the
> network bootscripts?  Will these changes still get to make it into 
> LFS-6.0?  Also, we need a way to order the services both up and down.

Changed subject, since this isn't really (only) hotplug anymore.  ;-)

The order of services will be whatever order the user specifies in the
SERVICE variable.  i.e.:

SERVICE=dhcp,static

will run the dhcp script first, then the static script.  Presumably this
makes some kind of sense for somebody's network setup (I can't actually
think of any way that this would be usable, except for assigning
multiple IPs to a single NIC, which maybe would be done by setting
SERVICE=static1,static2?) -- if not, oh well, it was only a long-weekend
hack.  ;-)

I guess the only question is, would it work to use the same order when
bringing the interface (and all related services) down?  It would be
cleaner to use reverse order, obviously, I'm just not quite sure how to
do that given only bash/ash functionality and what's in /bin.  I could
do it with a couple calls to rev (from util-linux -- one call to reverse
the whole SERVICE variable, and another to re-reverse each component),
but that's in /usr/bin, and /usr may not be mounted.

Wait, I can do it with another loop.  With SERVICE and IFS set up:

for svc in $SERVICE
do
     # Add on to the beginning: reverse the string
     REVSVC="$svc,$REVSVC"
done

# Remove the final pesky comma
REVSVC=${REVSVC%,}

After that, continue on with the ifdown loop, through each service in
$REVSVC.  That ought to work (I might need to restore IFS between the
first loop and the "Remove the final pesky comma" stuff, but that's
easily discoverable with a bit more testing that I'm not going to do at
the moment).




More information about the lfs-dev mailing list