Directory-based client configuration (was: "Dynamic" dhcp-client configuration using two interfaces? )

Kenneth Porter shiva at sewingwitch.com
Sat Dec 6 02:26:09 UTC 2003


--On Friday, December 05, 2003 10:10 AM -0500 "Brian J. Murrell" 
<dhcp-lists-in at interlinx.bc.ca> wrote:

> run-parts is the workhorse of this type of solution.

Good idea. I drilled through that learning how Red Hat's directory-based 
crontab system works...

Hmm, looking at run-parts in Red Hat, it looks like it's part of the 
crontabs package (providing /etc/crontabs and the empty directories to 
contain the scripts), not a separate module. So this would place a 
dependency on the crontabs package, which doesn't seem appropriate.

Does it make sense to just lift the code from the run-parts script into 
dhclient-script? I reproduce it here for reference:

#!/bin/bash

# run-parts - concept taken from Debian

# keep going when something fails
set +e

if [ $# -lt 1 ]; then
        echo "Usage: run-parts <dir>"
        exit 1
fi

if [ ! -d $1 ]; then
        echo "Not a directory: $1"
        exit 1
fi

# Ignore *~ and *, scripts
for i in $1/*[^~,] ; do
        [ -d $i ] && continue
        # Don't run *.{rpmsave,rpmorig,rpmnew,swp} scripts
        [ "${i%.rpmsave}" != "${i}" ] && continue
        [ "${i%.rpmorig}" != "${i}" ] && continue
        [ "${i%.rpmnew}" != "${i}" ] && continue
        [ "${i%.swp}" != "${i}" ] && continue
        [ "${i%,v}" != "${i}" ] && continue

        if [ -x $i ]; then
                $i 2>&1 | awk -v "progname=$i" \
                              'progname {
                                   print progname ":\n"
                                   progname="";
                               }
                               { print; }'
        fi
done

exit 0



More information about the dhcp-hackers mailing list