bug in dbus dhclient script patch?



Either I need to be bash-educated, or I've found a little bug in the
dbus patch for the dhclient script.

I'm running ubuntu breezy, and the default dhclient-script has this at
the very top of it:

        if [ -n "${dhc_dbus}" ]; then
           /usr/bin/dbus-send \
               --system \
               --dest=com.redhat.dhcp \
               --type=method_call \
               /com/redhat/dhcp/$interface \
               com.redhat.dhcp.set \
               'string:'"`env | /bin/egrep -v '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`";
               if (( ( dhc_dbus & 31 ) == 31 )); then
                   exit 0;
               fi;
        fi;

So, problem #1 to my bash-n00b mind is that the line:
        if (( ( dhc_dbus & 31 ) == 31 )); then
is missing a "$" before "dhc_dbus".  Am I missing something that is
obvious to someone more experienced in bash scripting?

Also, as j pointed out to me in IRC yesterday, the ubuntu script has
this little snippet a little too early in the script, and it really
should call "exit_with_hooks", rather than simply "exit".  I've attached
a patch for the ubuntu breezy dhclient-script, which seems to Work For
Me (tm).

-- 
Brett Johnson <brett hp com>
--- dhclient-script.orig        2005-10-27 17:19:04.000000000 -0600
+++ dhclient-script     2005-10-28 16:22:14.000000000 -0600
@@ -11,19 +11,6 @@

 # The alias handling in here probably still sucks. -mdz

-if [ -n "${dhc_dbus}" ]; then
-   /usr/bin/dbus-send \
-       --system \
-       --dest=com.redhat.dhcp \
-       --type=method_call \
-       /com/redhat/dhcp/$interface \
-       com.redhat.dhcp.set \
-       'string:'"`env | /bin/egrep -v '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`";
-       if (( ( dhc_dbus & 31 ) == 31 )); then
-           exit 0;
-       fi;
-fi;
-
 make_resolv_conf() {
     if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
         local new_resolv_conf=/etc/resolv.conf.dhclient-new
@@ -135,6 +122,19 @@
 run_hook /etc/dhcp3/dhclient-enter-hooks
 run_hookdir /etc/dhcp3/dhclient-enter-hooks.d

+if [ -n "${dhc_dbus}" ]; then
+   /usr/bin/dbus-send \
+       --system \
+       --dest=com.redhat.dhcp \
+       --type=method_call \
+       /com/redhat/dhcp/$interface \
+       com.redhat.dhcp.set \
+       'string:'"`env | /bin/egrep -v '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`";
+       if (( ( $dhc_dbus & 31 ) == 31 )); then
+          exit_with_hooks 0
+       fi;
+fi;
+
 # Execute the operation
 case "$reason" in
     MEDIUM|ARPCHECK|ARPSEND)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]