# #
###############################################################################
+# Allow only one instance of this hook
+HOOK_UNIQUE="true"
+
hook_new() {
local zone="${1}"
shift
+ # Check if we are allowed to have multiple configurations of $HOOK
+ if enabled HOOK_UNIQUE && zone_config_hook_is_configured "${zone}" "${HOOK}"; then
+ error "You can only have one configuration of type ${HOOK}"
+ return ${EXIT_CONF_ERROR}
+ fi
+
local id=$(zone_config_get_new_id ${zone})
log DEBUG "ID for the config is: ${id}"
fi
}
-hook_new() {
- local zone="${1}"
- shift
-
- if zone_config_hook_is_configured ${zone} "dhcp"; then
- log ERROR "You can configure the dhcp hook only once for a zone"
- return ${EXIT_ERROR}
- fi
-
- local id=$(zone_config_get_new_id ${zone})
- log DEBUG "ID for the config is: ${id}"
-
- # Import defaults
- hook_set_defaults
-
- if ! hook_parse_cmdline "${id}" "$@"; then
- # Return an error if the parsing of the cmd line fails
- return ${EXIT_ERROR}
- fi
-
- zone_config_settings_write "${zone}" "${HOOK}" "${id}"
-
- exit ${EXIT_OK}
-}
-
hook_up() {
local zone=${1}
local config=${2}
done <<< "$(args "$@")"
}
-hook_new() {
- local zone="${1}"
- shift
-
- if zone_config_hook_is_configured ${zone} "ipv6-auto"; then
- log ERROR "You can configure the ipv6-auto hook only once for a zone"
- return ${EXIT_ERROR}
- fi
-
- local id=$(zone_config_get_new_id ${zone})
- log DEBUG "ID for the config is: ${id}"
-
- if ! hook_parse_cmdline "${id}" "$@"; then
- # Return an error if the parsing of the cmd line fails
- return ${EXIT_ERROR}
- fi
-
- zone_config_settings_write "${zone}" "${HOOK}" "${id}"
-
- exit ${EXIT_OK}
-}
-
hook_up() {
local zone=${1}
shift
done
}
-hook_new() {
- local zone=${1}
- shift
-
- if zone_config_hook_is_configured ${zone} "pppoe-server"; then
- log ERROR "You can configure the pppoe-server hook only once for a zone"
- return ${EXIT_ERROR}
- fi
-
- local id=$(zone_config_get_new_id ${zone})
- log DEBUG "ID for the config is: ${id}"
-
- if ! hook_parse_cmdline "${id}" "$@"; then
- # Return an error if the parsing of the cmd line fails
- return ${EXIT_ERROR}
- fi
-
- zone_config_settings_write "${zone}" "${HOOK}" "${id}"
-
- exit ${EXIT_OK}
-}
-
hook_up() {
local zone=${1}
local config=${2}
. /usr/lib/network/header-config
+# Allow multiple instances of this hook
+HOOK_UNIQUE="false"
+
HOOK_SETTINGS=(
"ADDRESS"
"PREFIX"