From: Michael Tremer Date: Wed, 26 Aug 2015 12:31:29 +0000 (+0200) Subject: Update all config hooks according to the new naming convention X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fnetwork.git;a=commitdiff_plain;h=b6d9bf2bf70a358d48321621f02b5aecc60d7f1c Update all config hooks according to the new naming convention Signed-off-by: Michael Tremer --- diff --git a/src/hooks/configs/ipv4-dhcp b/src/hooks/configs/ipv4-dhcp index c3fa5008..cf246851 100644 --- a/src/hooks/configs/ipv4-dhcp +++ b/src/hooks/configs/ipv4-dhcp @@ -21,30 +21,30 @@ . /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 diff --git a/src/hooks/configs/ipv4-static b/src/hooks/configs/ipv4-static index 7c9d94f9..72b748c7 100644 --- a/src/hooks/configs/ipv4-static +++ b/src/hooks/configs/ipv4-static @@ -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} } - diff --git a/src/hooks/configs/ipv6-dhcp b/src/hooks/configs/ipv6-dhcp index 1ea78b54..03dbbf05 100644 --- a/src/hooks/configs/ipv6-dhcp +++ b/src/hooks/configs/ipv6-dhcp @@ -23,7 +23,7 @@ HOOK_CONFIG_SETTINGS="HOOK" -hook_create() { +hook_new() { local zone="${1}" shift diff --git a/src/hooks/configs/ipv6-static b/src/hooks/configs/ipv6-static index adb4ddf6..f0d07e4a 100644 --- a/src/hooks/configs/ipv6-static +++ b/src/hooks/configs/ipv6-static @@ -19,11 +19,11 @@ # # ############################################################################### -. /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}) diff --git a/src/hooks/configs/pppoe-server b/src/hooks/configs/pppoe-server index 84148ddd..d952ecc2 100644 --- a/src/hooks/configs/pppoe-server +++ b/src/hooks/configs/pppoe-server @@ -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