Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 167330
Collapse All | Expand All

(-)/lib/udev/net.sh (-16 / +54 lines)
Lines 2-28 Link Here
2
#
2
#
3
# net.sh: udev external RUN script
3
# net.sh: udev external RUN script
4
#
4
#
5
# Copyright 2007 Roy Marples <uberlord@gentoo.org>
6
# Distributed under the terms of the GNU General Public License v2
7
5
8
IFACE=$1
6
IFACE="$1"
9
ACTION=$2
7
ACTION="$2"
10
8
11
SCRIPT=/etc/init.d/net.$IFACE
9
if grep -q initng /proc/1/cmdline 
10
then
11
    EXEC="/sbin/ngc"
12
    INITNG="yes"
13
    EINIT="no"
14
elif grep -q einit /proc/1/cmdline
15
then
16
    EXEC="/sbin/einit-control"
17
    INITNG="no"
18
    EINIT="yes"
19
else
20
    EXEC="/etc/init.d/net.${IFACE}"
21
    INITNG="no"
22
    EINIT="no"
23
fi
12
24
13
# ignore interfaces that are registered after being "up" (?)
25
case "${ACTION}" in
14
case ${IFACE} in
26
    start)
15
    ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
27
	if [ "${INITNG}" = "yes" ]
16
    	exit 0 ;;
28
	then
29
	    ARGS="-u net/${IFACE}"
30
	elif [ "${EINIT}" = "yes" ]
31
	then
32
	    ARGS="rc net-${IFACE} enable"
33
	else
34
	    ARGS="--quiet start"
35
	fi
36
	;;
37
    stop)
38
	if [ "${INITNG}" = "yes" ]
39
	then
40
	    ARGS="-d net/${IFACE}"
41
	elif [ "${EINIT}" = "yes" ]
42
	then
43
	    ARGS="rc net-${IFACE} disable"
44
	else
45
	    ARGS="--quiet stop"
46
	fi
47
	;;
48
    *)
49
	echo "$0: wrong arguments" >&2
50
	echo "Call with <interface> <start|stop>" >&2
51
	exit 1
52
	;;
17
esac
53
esac
18
54
19
if [ ! -x "${SCRIPT}" ] ; then
55
export IN_HOTPLUG=1
20
    logger -t udev-net.sh "${SCRIPT}: does not exist or is not executable"
56
57
if [ -x "${EXEC}" ]
58
then
59
    ${EXEC} ${ARGS}
60
    exit 0
61
else
62
    logger -t netplug "Error: Couldn't configure ${IFACE}, no ${EXEC} !"
21
    exit 1
63
    exit 1
22
fi
64
fi
23
65
24
# If we're stopping then sleep for a bit in-case a daemon is monitoring
66
# vim: set ts=4
25
# the interface. This to try and ensure we stop after they do.
26
[ "${ACTION}" == "stop" ] && sleep 2
27
28
IN_HOTPLUG=1 "${SCRIPT}" --quiet "${ACTION}"

Return to bug 167330