From ae1def398927b144d59bb45aa08f3c8745c97be8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 18 Jun 2010 00:35:53 +0200 Subject: [PATCH] network: bridge ipv4-static: Add some nice status output. --- hooks/bridge.configs/ipv4-static | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hooks/bridge.configs/ipv4-static b/hooks/bridge.configs/ipv4-static index 3071ef3b..6ff7f7d8 100755 --- a/hooks/bridge.configs/ipv4-static +++ b/hooks/bridge.configs/ipv4-static @@ -108,6 +108,33 @@ function _down() { exit ${EXIT_OK} } +function _status() { + local zone=${1} + local config=${2} + shift 2 + + if ! device_exists ${zone}; then + error "Zone '${zone}' doesn't exist." + exit ${EXIT_ERROR} + fi + + config_read $(zone_dir ${zone})/${config} + + echo -n " ${HOOK} - ${ADDRESS}/${PREFIX} - " + if zone_has_ipv4 ${zone} ${ADDRESS}/${PREFIX}; then + echo -ne "${COLOUR_OK}OK ${COLOUR_NORMAL}" + else + echo -ne "${COLOUR_ERROR}ERROR${COLOUR_NORMAL}" + fi + echo # End line + + if [ -n "${GATEWAY}" ]; then + echo " Gateway: ${GATEWAY}" + fi + + exit ${EXIT_OK} +} + function ipv4_mask_to_cidr() { local mask=0 -- 2.39.2