From: Michael Tremer Date: Mon, 3 Jun 2019 09:55:35 +0000 (+0200) Subject: vlan: Convert hook to use parse_cmdline function X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=96045e9c044a709407b40df4145011e335929a3e vlan: Convert hook to use parse_cmdline function Signed-off-by: Michael Tremer --- diff --git a/src/hooks/ports/vlan b/src/hooks/ports/vlan index f5119864..69f5144c 100644 --- a/src/hooks/ports/vlan +++ b/src/hooks/ports/vlan @@ -51,7 +51,14 @@ hook_check_settings() { done } -hook_new() { +hook_find_port_name() { + assert isset PARENT_DEVICE + assert isset TAG + + print "${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}" +} + +hook_parse_cmdline() { while [ $# -gt 0 ]; do case "${1}" in --parent-device=*) @@ -63,42 +70,9 @@ hook_new() { --tag=*) TAG=$(cli_get_val "${1}") ;; - *) - warning "Unknown argument '${1}'" - ;; - esac - shift - done - - local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}" - - port_settings_write "${port}" - - exit ${EXIT_OK} -} - -hook_edit() { - local port=${1} - assert isset port - shift - - port_settings_read "${port}" - - while [ $# -gt 0 ]; do - case "${1}" in - --address=*) - ADDRESS=$(cli_get_val "${1}") - ;; - *) - warning "Unknown argument '${1}'" - ;; esac shift done - - port_settings_write "${port}" - - exit ${EXIT_OK} } hook_create() {