]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/hooks/configs/ipv4-dhcp
Update all config hooks according to the new naming convention
[people/stevee/network.git] / src / hooks / configs / ipv4-dhcp
index ea78d0969b49a27be0761f26beb289821a53f2ba..cf246851694c5264b8a02aae66681b7d5c7eca6c 100644 (file)
 
 . /usr/lib/network/header-config
 
-HOOK_SETTINGS="HOOK DELAY"
+HOOK_CONFIG_SETTINGS="HOOK DELAY"
 
 # Default settings.
 DELAY=0
 
-hook_check() {
+hook_check_config_settings() {
        assert isset DELAY
        assert isinteger DELAY
 }
 
-hook_create() {
-       local zone=${1}
+hook_new() {
+       local zone="${1}"
        shift
 
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --delay=*)
-                               DELAY=${1#--delay=}
+                               DELAY="$(cli_get_val "${1}")"
                                ;;
                esac
                shift
        done
 
-       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}"
 
        exit ${EXIT_OK}
 }
@@ -91,7 +91,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        local status
        if dhclient_status ${zone} ipv4; then
@@ -101,8 +101,8 @@ hook_status() {
        fi
        cli_statusline 3 "${HOOK}" "${status}"
 
-       cli_print_fmt1 3 "IPv4 address" "$(routing_db_get ${zone} ipv4 local-ip-address)"
-       local gateway=$(routing_db_get ${zone} ipv4 remote-ip-address)
+       cli_print_fmt1 3 "IPv4 address" "$(db_get "${zone}/ipv4/local-ip-address")"
+       local gateway="$(db_get "${zone}/ipv4/remote-ip-address")"
        if isset gateway; then
                cli_print_fmt1 3 "Gateway" "${gateway}"
        fi