python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / netplug / netplug-script
blob1af714d69b60584e5c6f38d7349addb0aeecb218
1 #!/bin/sh
3 # netplug - policy agent for netplugd
5 # Copyright 2003 Key Research, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License, version 2, as
9 # published by the Free Software Foundation. You are forbidden from
10 # redistributing or modifying it under the terms of any other license,
11 # including other versions of the GNU General Public License.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
19 PATH=/usr/bin:/bin:/usr/sbin:/sbin
20 export PATH
22 dev="$1"
23 action="$2"
25 case "$action" in
26 in)
27 if [ -x /sbin/ifup ]; then
28 exec /sbin/ifup $dev
29 else
30 echo "Please teach me how to plug in an interface!" 1>&2
31 exit 1
34 out)
35 if [ -x /sbin/ifdown ]; then
36 # At least on Fedora Core 1, the call to ip addr flush infloops
37 # /sbin/ifdown $dev && exec /sbin/ip addr flush $dev
38 exec /sbin/ifdown $dev
39 else
40 echo "Please teach me how to unplug an interface!" 1>&2
41 exit 1
44 probe)
45 # exec /sbin/ip link set $dev up >/dev/null 2>&1
46 if [ -x /sbin/ifconfig ]; then
47 exec /sbin/ifconfig $dev up >/dev/null 2>&1
48 else
49 echo "Failed to probe an interface!" 1>&2
50 exit 1
54 echo "I have been called with a funny action of '%s'!" 1>&2
55 exit 1
57 esac