Update all config hooks according to the new naming convention
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Aug 2015 12:31:29 +0000 (14:31 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Aug 2015 12:31:29 +0000 (14:31 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/configs/ipv4-dhcp
src/hooks/configs/ipv4-static
src/hooks/configs/ipv6-dhcp
src/hooks/configs/ipv6-static
src/hooks/configs/pppoe-server

index c3fa500..cf24685 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
index 7c9d94f..72b748c 100644 (file)
@@ -23,9 +23,9 @@
 
 HOOK_MANPAGE="network-config-ipv4-static"
 
-HOOK_SETTINGS="HOOK ADDRESS PREFIX GATEWAY"
+HOOK_CONFIG_SETTINGS="HOOK ADDRESS PREFIX GATEWAY"
 
-hook_check() {
+hook_check_config_settings() {
        assert isset ADDRESS
        assert isinteger PREFIX
 
@@ -35,7 +35,7 @@ hook_check() {
        fi
 }
 
-hook_create() {
+hook_new() {
        local zone="${1}"
        assert zone_exists "${zone}"
        shift
@@ -107,7 +107,7 @@ hook_create() {
        fi
 
        # XXX maybe we can add some hashing to identify a configuration again
-       zone_config_settings_write "${zone}" "${HOOK}.$(uuid)" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}.$(uuid)"
 
        exit ${EXIT_OK}
 }
@@ -122,7 +122,7 @@ hook_up() {
                exit ${EXIT_ERROR}
        fi
 
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -148,7 +148,7 @@ hook_down() {
                exit ${EXIT_ERROR}
        fi
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -172,7 +172,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        local status
        if zone_has_ip ${zone} ${ADDRESS}/${PREFIX}; then
@@ -190,4 +190,3 @@ hook_status() {
 
        exit ${EXIT_OK}
 }
-
index 1ea78b5..03dbbf0 100644 (file)
@@ -23,7 +23,7 @@
 
 HOOK_CONFIG_SETTINGS="HOOK"
 
-hook_create() {
+hook_new() {
        local zone="${1}"
        shift
 
index adb4ddf..f0d07e4 100644 (file)
 #                                                                             #
 ###############################################################################
 
-. /usr/lib/network/header-port
+. /usr/lib/network/header-config
 
-HOOK_SETTINGS="HOOK ADDRESS PREFIX GATEWAY"
+HOOK_CONFIG_SETTINGS="HOOK ADDRESS PREFIX GATEWAY"
 
-hook_check() {
+hook_check_config_settings() {
        assert isset ADDRESS
        assert isinteger PREFIX
 
@@ -33,7 +33,7 @@ hook_check() {
        fi
 }
 
-hook_create() {
+hook_new() {
        local zone=${1}
        shift
 
@@ -59,7 +59,7 @@ hook_create() {
                GATEWAY=$(ipv6_implode ${GATEWAY})
        fi
 
-       zone_config_settings_write "${zone}" "${HOOK}.$(ipv6_hash ${ADDRESS}).${PREFIX}" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}.$(ipv6_hash ${ADDRESS}).${PREFIX}"
 
        exit ${EXIT_OK}
 }
@@ -74,7 +74,7 @@ hook_up() {
                exit ${EXIT_ERROR}
        fi
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -100,7 +100,7 @@ hook_down() {
        # Remove routing information from database.
        db_delete "${zone}/ipv6"
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -120,7 +120,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        # Make sure ADDRESS is as short as possible.
        ADDRESS=$(ipv6_implode ${ADDRESS})
index 84148dd..d952ecc 100644 (file)
@@ -21,7 +21,7 @@
 
 . /usr/lib/network/header-config
 
-HOOK_SETTINGS="HOOK MTU SERVICE_NAME SUBNET MAX_SESSIONS"
+HOOK_CONFIG_SETTINGS="HOOK MTU SERVICE_NAME SUBNET MAX_SESSIONS"
 
 # Maximum Transmission Unit.
 MTU=1492
@@ -37,13 +37,13 @@ SUBNET=
 # 0 = unlimited.
 MAX_SESSIONS=0
 
-hook_check() {
+hook_check_config_settings() {
        assert isset MTU
        assert isset SUBNET
        assert isset MAX_SESSIONS
 }
 
-hook_create() {
+hook_new() {
        local zone=${1}
        shift
 
@@ -65,7 +65,7 @@ hook_create() {
                shift
        done
 
-       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}"
 
        exit ${EXIT_OK}
 }
@@ -107,7 +107,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        local status
        if pppoe_server_status ${zone}; then