X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage2%2Fbootscripts%2Fifdown;h=fe1406fa051fb53c0f64447e3ed1af93824084d9;hb=6039efc819b29ad7fa890c95fda918c57ebe475c;hp=cc0951a921cf3f7e9d5d693fd35cda8bfba249a6;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage2/bootscripts/ifdown b/stage2/bootscripts/ifdown index cc0951a..fe1406f 100755 --- a/stage2/bootscripts/ifdown +++ b/stage2/bootscripts/ifdown @@ -14,6 +14,15 @@ log_script_name "$0 $*" # Load network interface card parameters source /etc/sysconfig/network/ifconfig.${DEVICE} +# Load DHCP client parameters +source /etc/sysconfig/network/dhcp-client + +# Make sure DHCP client is available. +if [ ! -x ${DHCP_PROG} ]; then + echo "Program \"${DHCP_PROG}\" is not executable." + exit ${EXIT_CODE_FAILURE} +fi + # Check that the brctl program is present and executable. check_brctl() { @@ -23,29 +32,39 @@ check_brctl() fi } -if [ "$BOOTPROTO" == "dhcp" ]; then - # DHCP configuration +# First make sure interface is available +if ! ip link show ${DEVICE} 1> /dev/null 2>&1 ; then + echo "Interface ${DEVICE} not available" + exit ${EXIT_CODE_WARNING} +fi - # Load DHCP client parameters - source /etc/sysconfig/network/dhcp-client +case ${BOOTPROTO} in + dhcp) + cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \ + exit ${EXIT_CODE_FAILURE} + ;; - if [ ! -x ${DHCP_PROG} ]; then - echo "Program \"${DHCP_PROG}\" is not executable." - exit ${EXIT_CODE_FAILURE} - fi - cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || exit ${EXIT_CODE_FAILURE} -elif [ x${BOOTPROTO} = "xstatic" ]; then - # Static configuration - cmd_run_log ip addr flush ${DEVICE} && - cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} -elif [ x${BOOTPROTO} = "xpppoe" ]; then - # PPPoE configuration - cmd_run_log pppoe-stop - cmd_run_log ip addr flush ${DEVICE} && - cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} -else - exit 1 -fi + wifi) + cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \ + exit ${EXIT_CODE_FAILURE} + echo "Stopping wpa_supplicant" + killall wpa_supplicant + ;; + + static) + ;; + + pppoe) + cmd_run_log pppoe-stop + ;; + + *) + echo "Invalid BOOTPROTO value: ${BOOTPROTO}" + exit ${EXIT_CODE_FAILURE} +esac + +cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE} +cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} # Determining if the interface is part of a bridge: if [ -n "${BRIDGE_TO}" ]; then @@ -54,7 +73,7 @@ if [ -n "${BRIDGE_TO}" ]; then fi # Determining if the interface is a bridge: -if [ "x${BRIDGE}" == "xyes" ]; then +if [ "x${BRIDGE}" = "xyes" ]; then # Check that the brctl program is present and executable. if [ ! -x ${BRCTL} ]; then msg_log "*** ERROR: /usr/sbin/brctl not found."