]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
if_up and if_down variables allow more flexability.
authorRoy Marples <roy@marples.name>
Sat, 7 Aug 2010 19:44:21 +0000 (19:44 +0000)
committerRoy Marples <roy@marples.name>
Sat, 7 Aug 2010 19:44:21 +0000 (19:44 +0000)
dhcpcd-hooks/20-resolv.conf
dhcpcd-hooks/29-lookup-hostname
dhcpcd-hooks/30-hostname
dhcpcd-hooks/50-ntp.conf
dhcpcd-hooks/50-yp.conf
dhcpcd-run-hooks.in

index 60f430b686e779aaa2a34412a08690e9ade946b8..628636dc72fd3620df81518e21910756b6979457 100644 (file)
@@ -119,7 +119,8 @@ remove_resolv_conf()
        fi
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       add_resolv_conf;;
-PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) remove_resolv_conf;;
-esac
+if $if_up; then
+       add_resolv_conf
+elif $if_down; then
+       remove_resolv_conf
+fi
index ce131225d6329cff4b9c0f0f17707c7848a335e9..8661fccd8f037cbaa3cf0e78ef253520aff1b5af 100644 (file)
@@ -29,6 +29,6 @@ set_hostname()
        fi
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       set_hostname;;
-esac
+if $if_up; then
+       set_hostname
+fi
index a19fc0df5526a8bdac18e773ead1cdb8a9475822..87446fbe0cd688879c2c82c3f0e4d5fa05bbaf73 100644 (file)
@@ -29,6 +29,6 @@ set_hostname()
        fi
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       set_hostname;;
-esac
+if $if_up; then
+       set_hostname
+fi
index 9ca262ef66fe171ec5bb2f9ed28d8c8fb23e8027..da8f83cc523a8905cc7eaa69ecec54458c387981 100644 (file)
@@ -101,7 +101,8 @@ remove_ntp_conf()
        build_ntp_conf
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       add_ntp_conf add;;
-PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) remove_ntp_conf del;;
-esac
+if $if_up; then
+       add_ntp_conf add
+elif $if_down; then
+       remove_ntp_conf del
+fi
index 4bdd0623e7f465cf238cf1cdb49096fc94619a91..a1f579880643cbff88090a6a5d5d8fc4a35d2738 100644 (file)
@@ -44,7 +44,8 @@ restore_yp_conf()
        fi
 }
 
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       make_yp_conf;;
-EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)         restore_yp_conf;;
-esac
+if $if_up; then
+       make_yp_conf
+elif $if_down; then
+       restore_yp_conf
+fi
index 521529becc613ed6dae1952dcbee7eff93478549..46ed6d55835e67f44a09ed86e895023f1743df2c 100644 (file)
@@ -9,6 +9,13 @@ signature_base_end="# End of dhcpcd"
 signature_end="$signature_base_end $from $interface"
 state_dir=/var/run/dhcpcd
 
+if_up=false
+if_down=false
+case "$reason" in
+BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)       if_up=true;;
+PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) if_down=true;;
+esac
+
 # Ensure that all arguments are unique
 uniqify()
 {