Description of problem: Bringing up a network interface configured via dhcp ends up with errors like these: /sbin/dhclient-script: line 363: ${subsystem}_config: command not found Twice. The code in question looks like follows: for f in /etc/dhcp/dhclient.d/*.sh ; do if [ -x ${f} ]; then subsystem="$(basename ${f} .sh)" . ${f} \${subsystem}_config fi done and indeed attempts to use a command with a literal '$' in it like in the error message. Eh??? Forgotten 'eval' or something of that sort? Or this was rather supposed to read . ${f} "${subsystem}_config" BTW - a 'basename' invocation is spurious as variable expansion does the job: subsystem="${f%.sh}" Version-Release number of selected component (if applicable): dhcp-4.1.0-6.fc11 How reproducible: always
How is this: Index: dhclient-script =================================================================== RCS file: /cvs/pkgs/rpms/dhcp/devel/dhclient-script,v retrieving revision 1.5 diff -u -p -r1.5 dhclient-script --- dhclient-script 18 Feb 2009 04:12:59 -0000 1.5 +++ dhclient-script 19 Feb 2009 02:36:16 -0000 @@ -358,9 +358,8 @@ dhconfig() { if [ -d /etc/dhcp/dhclient.d ]; then for f in /etc/dhcp/dhclient.d/*.sh ; do if [ -x ${f} ]; then - subsystem="$(basename ${f} .sh)" - . ${f} - \${subsystem}_config + subsystem="${f%.sh}" + . ${f} "${subsystem}_config" fi done fi
> How is this: ... That will work just fine (if this was an intention). As a matter of fact I did such change already on my copy of dhclient-script, as a "temporary" fix, and nothing bad happened. :-)
Very good, thanks. Will be fixed in dhcp-4.1.0-8.fc11 I really find shell scripts frustrating. I spend the majority of my time writing C or Python and when I have to do something simple in shell, I almost always fail. Oh well. BTW, this addition to dhclient-script is so that other services can latch on to the dhclient-script run by providing their own scripts in /etc/dhcp/dhclient.d. It's so I don't have to keep maintaining dhclient-script and updating for every little change to ntp, nis, and other such services that may be pulling info from the DHCP lease.
> BTW, this addition to dhclient-script is so that other services can latch on to > the dhclient-script Yes, that how it looked to me. At least one of existing scripts, nis.sh, takes an argument but I was not entirely sure if a dhclient-script code resulted from a slip of a finger in an editor or you had in mind something fiendishly clever.