ifup, ifdown: display an error message when executed without any argument

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2013-02-21 21:30:24 +01:00
parent 83dce52968
commit 60535caa3b
2 changed files with 9 additions and 3 deletions

View File

@ -1,13 +1,16 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009 by Davide Madrisan <davide.madrisan@gmail.com> # Copyright (c) 2003-2009,2013 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc . /etc/sysconfig/rc
. $rc_functions . $rc_functions
DEVICE=${1} DEVICE=${1}
[ "${DEVICE}" ] || exit 1 if [ -z "$DEVICE" ]; then
echo "Usage: ifdown <device name>" 1>&2
exit 1
fi
[ "$NM_CONTROLLED" = "0" ] || exit 0 [ "$NM_CONTROLLED" = "0" ] || exit 0

View File

@ -8,7 +8,10 @@
DEVICE=${1} DEVICE=${1}
[ "${DEVICE}" ] || exit 1 if [ -z "$DEVICE" ]; then
echo "Usage: ifup <device name>" 1>&2
exit 1
fi
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
[ -r $network_devices/ifcfg-${DEVICE} ] && . $network_devices/ifcfg-${DEVICE} [ -r $network_devices/ifcfg-${DEVICE} ] && . $network_devices/ifcfg-${DEVICE}