X-Git-Url: http://git.ipfire.org/?p=people%2Farne_f%2Fnetwork.git;a=blobdiff_plain;f=header-port;fp=header-port;h=95b39d0e62007d17f22e2347d8709d27b6a2792f;hp=d06b2e119903ec8e8982492d0982373cc46283f2;hb=98f4dae6942efb34c7b3183deefee1dd514ee72e;hpb=1578dae929cd6e4fe51418e2180cd478fda938dc diff --git a/header-port b/header-port index d06b2e11..95b39d0e 100644 --- a/header-port +++ b/header-port @@ -22,6 +22,7 @@ . /lib/network/functions HOOK=$(basename ${0}) +INFO_SETTINGS="HOOK PORT_PARENTS PORT_CHILDREN" while [ $# -gt 0 ]; do case "${1}" in @@ -39,7 +40,7 @@ done function run() { case "${action}" in - edit|add|create|rem|up|down|status) + edit|add|create|rem|up|down|status|info) _${action} $@ ;; esac @@ -47,3 +48,26 @@ function run() { error "Port hook '${HOOK}' didn't exit properly." exit ${EXIT_ERROR} } + +function _info() { + local port=${1} + shift + + assert isset port + + config_read $(port_file ${port}) + + local key + local val + for key in PORT_PARENTS PORT_CHILDREN; do + val="${key}_VAR" + val=${!val} + eval "${key}=\"${!val}\"" + done + + for key in ${INFO_SETTINGS}; do + echo "${key}=\"${!key}\"" + done + + exit ${ERROR_OK} +}