diff options
author | David Kaspar [Dee'Kej] <dkaspar@redhat.com> | 2018-05-25 20:01:54 +0200 |
---|---|---|
committer | Dee'Kej <deekej@linuxmail.org> | 2018-05-30 12:32:22 +0200 |
commit | a145ddda284570e57413e37f025c3657205e17d8 (patch) | |
tree | a371338da02e38d8745964f75239c8ee62cc459b /network-scripts/ifdown | |
parent | db1ca2fadd20d0a4fb5a0fe18adcd8c960db9cf3 (diff) | |
download | initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.gz initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.bz2 initscripts-a145ddda284570e57413e37f025c3657205e17d8.tar.xz initscripts-a145ddda284570e57413e37f025c3657205e17d8.zip |
Repository scheme updated to new layout
NOTE: This commit just moves files around, without actually fixing the
Makefiles and specfile. See follow up commits which resolve this.
Diffstat (limited to 'network-scripts/ifdown')
-rwxr-xr-x | network-scripts/ifdown | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/network-scripts/ifdown b/network-scripts/ifdown new file mode 100755 index 00000000..18cee69d --- /dev/null +++ b/network-scripts/ifdown @@ -0,0 +1,71 @@ +#!/bin/bash + +unset WINDOW # defined by screen, conflicts with our usage + +. /etc/init.d/functions + +cd /etc/sysconfig/network-scripts +. ./network-functions + +[ -f ../network ] && . ../network + +CONFIG=$1 + +[ -z "$CONFIG" ] && { + echo $"usage: ifdown <configuration>" >&2 + exit 1 +} + +need_config "${CONFIG}" + +[ -f "$CONFIG" ] || { + echo $"usage: ifdown <configuration>" >&2 + exit 1 +} + +if [ $UID != 0 ]; then + if [ -x /usr/sbin/usernetctl ]; then + source_config + if /usr/sbin/usernetctl ${CONFIG} report ; then + exec /usr/sbin/usernetctl ${CONFIG} down + fi + fi + echo $"Users cannot control this device." >&2 + exit 1 +fi + +source_config + +if [ -n "$IN_HOTPLUG" ] && [ "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ] +then + exit 0 +fi + +if [ "$_use_nm" = "true" ]; then + if [ -n "$UUID" -a -z "$DEVICE" ]; then + DEVICE=$(nmcli -t --fields uuid,device con show --active | awk -F ':' "\$1 == \"$UUID\" { print \$2 }") + fi + if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then + if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | grep -Eq "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then + nmcli dev disconnect "$DEVICE" + exit $? + fi + exit 0 + fi +fi + +if [ -x /sbin/ifdown-pre-local ]; then + /sbin/ifdown-pre-local ${DEVICE} +fi + +OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}" + +if [ ! -x ${OTHERSCRIPT} ]; then + OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${TYPE}" +fi + +if [ ! -x ${OTHERSCRIPT} ]; then + OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth" +fi + +exec ${OTHERSCRIPT} ${CONFIG} $2 |