aboutsummaryrefslogtreecommitdiffstats
path: root/package/network-manager/S45network-manager
blob: 112aa660e56d80a501569a8901a77dd79090b630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

prefix=/usr
exec_prefix=/usr
sbindir=${exec_prefix}/sbin

NETWORKMANAGER_BIN=${sbindir}/NetworkManager

[ -x $NETWORKMANAGER_BIN ] || exit 0

PID=`pidof -o %PPID NetworkManager`
case "$1" in
	start)
		echo -n "Starting NetworkManager ... "
		[ ! -d /var/run/NetworkManager ] && install -d /var/run/NetworkManager
		if [ -z "$PID" ]; then
			$NETWORKMANAGER_BIN
		fi
		if [ ! -z "$PID" -o $? -gt 0 ]; then
			echo "failed!"
		else
			echo "done."
		fi
		;;
	stop)
		echo -n "Stopping NetworkManager ... "
			[ ! -z "$PID" ] && kill $PID &> /dev/null
		if [ $? -gt 0 ]; then
			echo "failed!"
		else
			echo "done."
		fi
		;;
	restart)
		$0 stop
		sleep 1
		$0 start
		;;
	*)
		echo "usage: $0 {start|stop|restart|sleep|wake}"
		;;
esac
exit 0