Revision 2573,
977 bytes
checked in by daisuke, 14 years ago
(diff) |
fix bash3ism
- bash4's source (or .) command does not search current directory any longer.
|
Rev | Line | |
---|
[1108] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | unset WINDOW # defined by screen, conflicts with our usage |
---|
| 4 | |
---|
| 5 | . /etc/init.d/functions |
---|
| 6 | |
---|
| 7 | cd /etc/sysconfig/network-scripts |
---|
[2573] | 8 | . /etc/sysconfig/network-scripts/network-functions |
---|
[1108] | 9 | |
---|
[2573] | 10 | [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network |
---|
[1108] | 11 | |
---|
| 12 | CONFIG=$1 |
---|
| 13 | |
---|
| 14 | [ -z "$CONFIG" ] && { |
---|
| 15 | echo $"usage: ifdown <device name>" >&2 |
---|
| 16 | exit 1 |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | need_config $CONFIG |
---|
| 20 | |
---|
| 21 | [ -f "$CONFIG" ] || { |
---|
| 22 | echo $"usage: ifdown <device name>" >&2 |
---|
| 23 | exit 1 |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | if [ $UID != 0 ]; then |
---|
| 27 | if [ -x /usr/sbin/usernetctl ]; then |
---|
| 28 | source_config |
---|
| 29 | if /usr/sbin/usernetctl ${CONFIG} report ; then |
---|
| 30 | exec /usr/sbin/usernetctl ${CONFIG} down |
---|
| 31 | fi |
---|
| 32 | fi |
---|
| 33 | echo $"Users cannot control this device." >&2 |
---|
| 34 | exit 1 |
---|
| 35 | fi |
---|
| 36 | |
---|
| 37 | source_config |
---|
| 38 | |
---|
| 39 | if [ -x /sbin/ifdown-pre-local ]; then |
---|
| 40 | /sbin/ifdown-pre-local ${DEVICE} |
---|
| 41 | fi |
---|
| 42 | |
---|
| 43 | OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}" |
---|
| 44 | |
---|
| 45 | if [ ! -x ${OTHERSCRIPT} ]; then |
---|
| 46 | OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth" |
---|
| 47 | fi |
---|
| 48 | |
---|
| 49 | exec ${OTHERSCRIPT} ${CONFIG} $2 |
---|
Note: See
TracBrowser
for help on using the repository browser.