]> git.ipfire.org Git - people/stevee/network.git/blobdiff - src/header-zone
ipv4-static: Update hook
[people/stevee/network.git] / src / header-zone
index eaebd1b684f512daabaffce5e06c4e107cdf9dcc..808a54a79e492153835d630027ed5b74370b9905 100644 (file)
@@ -28,11 +28,11 @@ function hook_create() {
        assert isset zone
        shift
 
-       config_read $(zone_dir ${zone})/settings
+       settings_read $(zone_dir ${zone})/settings
 
        hook_parse_cmdline $@
 
-       config_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
+       settings_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -69,17 +69,6 @@ function hook_discover() {
        exit ${DISCOVER_NOT_SUPPORTED}
 }
 
-# The default help function.
-function hook_help() {
-       # If no man page has been configured, we print an error message.
-       if [ -z "${HOOK_MANPAGE}" ]; then
-               error "There is no help available for hook '${HOOK}'. Exiting."
-               exit ${EXIT_ERROR}
-       fi
-
-       cli_show_man ${HOOK_MANPAGE}
-}
-
 # Do nothing
 function hook_parse_cmdline() {
        return ${EXIT_OK}
@@ -174,41 +163,26 @@ function hook_config_cmd() {
                exit ${EXIT_ERROR}
        fi
 
-       if ! hook_config_exists "${hook_zone}" "${hook_config}"; then
-               log ERROR "Hook '${hook_config}' is not supported for zone '${zone}'."
-               exit ${EXIT_ERROR}
-       fi
+       #if ! hook_config_exists "${hook_zone}" "${hook_config}"; then
+       #       log ERROR "Hook '${hook_config}' is not supported for zone '${zone}'."
+       #       exit ${EXIT_ERROR}
+       #fi
 
-       hook_zone_config_exec "${hook_zone}" "${hook_config}" "${cmd}" "${zone}" "$@"
+       hook_config_exec "${hook_config}" "${cmd}" "${zone}" "$@"
 }
 
 function hook_config_create() {
-       local zone="${1}"
-       assert isset zone
-
-       local hook_config="${2}"
-       assert isset hook_config
-
-       shift 2
-
-       if ! listmatch "${hook_config}" $(zone_get_supported_config_hooks ${zone}); then
-               log ERROR "Zone '${zone}' does not support configuration of type '${hook_config}'."
-               exit ${EXIT_ERROR}
-       fi
-
-       local hook_zone="$(zone_get_hook "${zone}")"
-       assert isset hook_zone
+       assert [ $# -gt 2 ]
 
-       hook_zone_config_exec "${hook_zone}" "${hook_config}" create "${zone}" "$@"
-       exit $?
+       hook_config_cmd "create" "$@"
 }
 
 function hook_config_edit() {
-       hook_config_cmd edit "$@"
+       hook_config_cmd "edit" "$@"
 }
 
 function hook_config_remove() {
-       cmd_not_implemented
+       hook_config_cmd "remove" "$@"
 }
 
 function hook_config_show() {