From: Jonatan Schlag Date: Wed, 19 Jul 2017 08:52:35 +0000 (+0200) Subject: pppoe-server: create hook_parse_cmdline function X-Git-Tag: 009~160 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=88b80413799cb7bbefc282a4bcb3dfcdfae5f818 pppoe-server: create hook_parse_cmdline function This patch just split the parsing of the cmd line into a separate function to allowing an edit with the generic hook_edit function. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/hooks/configs/pppoe-server b/src/hooks/configs/pppoe-server index 22e0906d..b4d25389 100644 --- a/src/hooks/configs/pppoe-server +++ b/src/hooks/configs/pppoe-server @@ -48,15 +48,7 @@ hook_check_config_settings() { 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 - +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --dns-server=*) @@ -102,6 +94,21 @@ hook_new() { esac 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 + + if ! hook_parse_cmdline $@; then + # Return an error if the parsing of the cmd line fails + return ${EXIT_ERROR} + fi zone_config_settings_write "${zone}" "${HOOK}"