Debian Codegraph @

setup/files/misc/arm-wol

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 #
5 # To arm wake on LAN for NIC in DRBL client.
6 #
7 # chkconfig: 2345 99 99
8 # description: To arm wake on LAN for NIC in DRBL client before it poweroffs.
9 # Author: Steven Shiau <steven _at_ clonezilla org>
10 # License: GPL
11 #
12 # For SuSE insserv
13 ### BEGIN INIT INFO
14 # Provides: arm-wol
15 # Required-Start:
16 # Required-Stop:
17 # X-UnitedLinux-Should-Start:
18 # X-UnitedLinux-Should-Stop:
19 # Default-Start: 2 3 4 5
20 # Default-Stop: 0 1 6
21 # Description: To arm wake on LAN for NIC in DRBL client before it poweroffs.
22 ### END INIT INFO
23
24 # Append a default search path.
25 PATH="$PATH:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
26 export PATH
27
28 #
29 if [scip-shell system . . `[`. ! "$UID" = "0" ]; then
30 echoscip-shell system . . echo.
31 echoscip-shell system . . echo. "[$LOGNAME] You need to run this script \"`basenamescip-shell system . . basename. $0`\" as root."
32 echoscip-shell system . . echo.
33 exit 1
34 fi
35
36 # Exclude some devices, like lo, sit0, vmnet... It's regular expression.
37 exluding_dev="(lo|sit[0-9]+|vmnet)"
38 export LC_ALL=C
39 if [scip-shell system . . `[`. -d /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. ]; then
40 # kernel support sysfs, so get the NIC devices from /sys
41 NETDEVICES="$(unalias ls &>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. | grepscip-shell system . . grep. -v -E "$exluding_dev")"
42 elif [scip-shell system . . `[`. -f /proc/net/devscip-shell filesystem . . `/proc/net/dev`. ]; then
43 # kernel do not support sysfs, so get the NIC devices from /proc
44 NETDEVICES="$(catscip-shell system . . cat. /proc/net/devscip-shell filesystem . . `/proc/net/dev`. | grepscip-shell system . . grep. "^.*:" | cutscip-shell system . . cut. -d: -f1 | grepscip-shell system . . grep. -v -E "$exluding_dev")"
45 else
46 echoscip-shell system . . echo. "Network interface card is not found in /sys/class/net/ or /proc/net/dev!"
47 echoscip-shell system . . echo. "Program terminated!"
48 exit 1
49 fi
50 echoscip-shell system . . echo. -n "Trying to arm the wake on LAN for "
51 RETVAL=0
52 for nic in $NETDEVICES; do
53 echoscip-shell system . . echo. -n "$nic... "
54 ethtool -s $nic wol g &> /dev/nullscip-shell filesystem . . `/dev/null`.
55 RETVAL="$((RETVAL+$?))"
56 done
57 echoscip-shell system . . echo. "done!"
58 exit $RETVAL