summaryrefslogtreecommitdiff
path: root/pm/power.d/disable_wol
blob: 4c720fbce25615f9bf40a8561d08e00c0389f4ae (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
#!/bin/sh

. "${PM_FUNCTIONS}"

command_exists ethtool || exit $NA

set_wol_status() {
    for d in "/sys/class/net/"*; do
	[ -f "$d/wireless" ] && continue
	[ -h "$d/device/driver" ] || continue
	case $1 in
	    disable) ethtool -s "${d##*/}" wol d;;
	    enable) ethtool -s "${d##*/}" wol g;;
	esac
    done
}

case $1 in
    true) set_wol_status disable;;
    false) set_wol_status enable;;
    *) exit $NA;;
esac

exit 0