wol: cosmetic changes
[packages.git] / net / wol / files / wol.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3
4 START=60
5
6 append_string() {
7         local section="$1"
8         local option="$2"
9         local value="$3"
10         local _val
11         config_get _val "$section" "$option"
12         [ -n "$_val" ] && append args "$3$_val"
13 }
14
15 start_service() {
16         local cfg="$1"
17         args=""
18
19         append_string "$cfg" broadcast "--host="
20         append_string "$cfg" port "--port="
21         append_string "$cfg" password "--passwd="
22         append_string "$cfg" mac ""
23         config_get_bool enabled "$cfg" "enabled" '1'
24         [ "$enabled" -gt 0 ] && /usr/bin/wol $args
25 }
26
27 start() {
28         config_load wol
29         config_foreach start_service wol-target
30 }