Blame network-scripts/ifdown

rpm-build 133ac4
#!/bin/bash
rpm-build 133ac4
rpm-build 133ac4
unset WINDOW # defined by screen, conflicts with our usage
rpm-build 133ac4
rpm-build 133ac4
. /etc/init.d/functions
rpm-build 133ac4
rpm-build 133ac4
cd /etc/sysconfig/network-scripts
rpm-build 133ac4
. ./network-functions
rpm-build 133ac4
rpm-build 133ac4
[ -f ../network ] && . ../network
rpm-build 133ac4
rpm-build 133ac4
CONFIG=$1
rpm-build 133ac4
rpm-build 133ac4
[ -z "$CONFIG" ] && {
rpm-build 133ac4
    echo $"usage: ifdown <configuration>" >&2
rpm-build 133ac4
    exit 1
rpm-build 133ac4
}
rpm-build 133ac4
rpm-build 133ac4
if ! [ -f /etc/sysconfig/disable-deprecation-warnings ] && ! is_true ${DEPRECATION_WARNING_ISSUED}; then
rpm-build 133ac4
    net_log $"You are using 'ifdown' script provided by 'network-scripts', which are now deprecated." warning ifdown >&2
rpm-build 133ac4
    net_log $"'network-scripts' will be removed in one of the next major releases of RHEL." warning ifdown >&2
rpm-build 133ac4
    net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifdown >&2
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
need_config "${CONFIG}"
rpm-build 133ac4
rpm-build 133ac4
[ -f "$CONFIG" ] || {
rpm-build 133ac4
    echo $"usage: ifdown <configuration>" >&2
rpm-build 133ac4
    exit 1
rpm-build 133ac4
}
rpm-build 133ac4
rpm-build 133ac4
if [ $UID != 0 ]; then
rpm-build 133ac4
    if [ -x /usr/sbin/usernetctl ]; then
rpm-build 133ac4
        source_config
rpm-build 133ac4
        if /usr/sbin/usernetctl ${CONFIG} report ; then
rpm-build 133ac4
            exec /usr/sbin/usernetctl ${CONFIG} down
rpm-build 133ac4
        fi
rpm-build 133ac4
    fi
rpm-build 133ac4
    echo $"Users cannot control this device." >&2
rpm-build 133ac4
    exit 1
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
source_config
rpm-build 133ac4
rpm-build 133ac4
if [ -n "$IN_HOTPLUG" ] && [ "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ]
rpm-build 133ac4
then
rpm-build 133ac4
    exit 0
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
if [ "$_use_nm" = "true" ]; then
rpm-build 133ac4
    if [ -n "$UUID" -a -z "$DEVICE" ]; then
rpm-build 133ac4
        DEVICE=$(nmcli -t --fields uuid,device con show --active | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
rpm-build 133ac4
    fi
rpm-build 133ac4
    if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then
rpm-build 133ac4
        if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | grep -Eq "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
rpm-build 133ac4
            nmcli dev disconnect "$DEVICE"
rpm-build 133ac4
            exit $?
rpm-build 133ac4
        fi
rpm-build 133ac4
        exit 0
rpm-build 133ac4
    fi
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
if [ -x /sbin/ifdown-pre-local ]; then
rpm-build 133ac4
    /sbin/ifdown-pre-local ${DEVICE}
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}"
rpm-build 133ac4
rpm-build 133ac4
if [ ! -x ${OTHERSCRIPT} ]; then
rpm-build 133ac4
    OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${TYPE}"
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
if [ ! -x ${OTHERSCRIPT} ]; then
rpm-build 133ac4
    OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
rpm-build 133ac4
fi
rpm-build 133ac4
rpm-build 133ac4
exec ${OTHERSCRIPT} ${CONFIG} $2