]> git.ipfire.org Git - people/stevee/network.git/commitdiff
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 c3fa5008b298770d93dc70e95fa0a67e07570efe..cf246851694c5264b8a02aae66681b7d5c7eca6c 100644 (file)
 
 . /usr/lib/network/header-config
 
 
 . /usr/lib/network/header-config
 
-HOOK_SETTINGS="HOOK DELAY"
+HOOK_CONFIG_SETTINGS="HOOK DELAY"
 
 # Default settings.
 DELAY=0
 
 
 # Default settings.
 DELAY=0
 
-hook_check() {
+hook_check_config_settings() {
        assert isset DELAY
        assert isinteger DELAY
 }
 
        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=*)
        shift
 
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --delay=*)
-                               DELAY=${1#--delay=}
+                               DELAY="$(cli_get_val "${1}")"
                                ;;
                esac
                shift
        done
 
                                ;;
                esac
                shift
        done
 
-       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}"
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -91,7 +91,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
                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
 
        local status
        if dhclient_status ${zone} ipv4; then
index 7c9d94f968c6bdb111a3e889c47ab5e3ea0f43cf..72b748c777054c232436981b0de765d813f75b3f 100644 (file)
@@ -23,9 +23,9 @@
 
 HOOK_MANPAGE="network-config-ipv4-static"
 
 
 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
 
        assert isset ADDRESS
        assert isinteger PREFIX
 
@@ -35,7 +35,7 @@ hook_check() {
        fi
 }
 
        fi
 }
 
-hook_create() {
+hook_new() {
        local zone="${1}"
        assert zone_exists "${zone}"
        shift
        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
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -122,7 +122,7 @@ hook_up() {
                exit ${EXIT_ERROR}
        fi
 
                exit ${EXIT_ERROR}
        fi
 
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -148,7 +148,7 @@ hook_down() {
                exit ${EXIT_ERROR}
        fi
        
                exit ${EXIT_ERROR}
        fi
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -172,7 +172,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
                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
 
        local status
        if zone_has_ip ${zone} ${ADDRESS}/${PREFIX}; then
@@ -190,4 +190,3 @@ hook_status() {
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
-
index 1ea78b540d5326644001ba2d43666557afbd942a..03dbbf05de4e75fb0a612b9b8c22eca51d4e42e5 100644 (file)
@@ -23,7 +23,7 @@
 
 HOOK_CONFIG_SETTINGS="HOOK"
 
 
 HOOK_CONFIG_SETTINGS="HOOK"
 
-hook_create() {
+hook_new() {
        local zone="${1}"
        shift
 
        local zone="${1}"
        shift
 
index adb4ddf64503d9d6f4c9d97218b683e545314711..f0d07e4a7639aa20cc6947b80293ab2e517828c2 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
 
        assert isset ADDRESS
        assert isinteger PREFIX
 
@@ -33,7 +33,7 @@ hook_check() {
        fi
 }
 
        fi
 }
 
-hook_create() {
+hook_new() {
        local zone=${1}
        shift
 
        local zone=${1}
        shift
 
@@ -59,7 +59,7 @@ hook_create() {
                GATEWAY=$(ipv6_implode ${GATEWAY})
        fi
 
                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}
 }
 
        exit ${EXIT_OK}
 }
@@ -74,7 +74,7 @@ hook_up() {
                exit ${EXIT_ERROR}
        fi
        
                exit ${EXIT_ERROR}
        fi
        
-       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
+       zone_config_settings_read "${zone}" "${config}"
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -100,7 +100,7 @@ hook_down() {
        # Remove routing information from database.
        db_delete "${zone}/ipv6"
        
        # 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}
 
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -120,7 +120,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
        
                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})
 
        # Make sure ADDRESS is as short as possible.
        ADDRESS=$(ipv6_implode ${ADDRESS})
index 84148ddd1e71bcd557c3ba1c0b301b5e3b1e9289..d952ecc24b9f237b81040658d0af14aaedbe8177 100644 (file)
@@ -21,7 +21,7 @@
 
 . /usr/lib/network/header-config
 
 
 . /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
 
 # Maximum Transmission Unit.
 MTU=1492
@@ -37,13 +37,13 @@ SUBNET=
 # 0 = unlimited.
 MAX_SESSIONS=0
 
 # 0 = unlimited.
 MAX_SESSIONS=0
 
-hook_check() {
+hook_check_config_settings() {
        assert isset MTU
        assert isset SUBNET
        assert isset MAX_SESSIONS
 }
 
        assert isset MTU
        assert isset SUBNET
        assert isset MAX_SESSIONS
 }
 
-hook_create() {
+hook_new() {
        local zone=${1}
        shift
 
        local zone=${1}
        shift
 
@@ -65,7 +65,7 @@ hook_create() {
                shift
        done
 
                shift
        done
 
-       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}"
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -107,7 +107,7 @@ hook_status() {
                exit ${EXIT_ERROR}
        fi
 
                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
 
        local status
        if pppoe_server_status ${zone}; then