om-watchdog: cosmetic code style fixes
[openwrt/staging/chunkeey.git] / package / kernel / om-watchdog / files / om-watchdog.init
1 #!/bin/sh /etc/rc.common
2 #
3 # Copyright (C) 2011 OpenWrt.org
4 #
5
6 START=11
7 STOP=11
8
9 USE_PROCD=1
10 NAME=om-watchdog
11 PROG=/sbin/om-watchdog
12
13 get_gpio() {
14 if [ -r /lib/ar71xx.sh ]; then
15 . /lib/ar71xx.sh
16 local board=$(ar71xx_board_name)
17
18 case "$board" in
19 "a40"|\
20 "a60"|\
21 "mr1750"|\
22 "mr1750v2"|\
23 "mr900"|\
24 "mr900v2")
25 return 16
26 ;;
27 "mr600v2")
28 return 15
29 ;;
30 "om2p"|\
31 "om2p-hs"|\
32 "om2p-hsv2"|\
33 "om2p-hsv3"|\
34 "om2p-hsv4"|\
35 "om2pv4"|\
36 "om5p-acv2")
37 return 12
38 ;;
39 "om2p-lc"|\
40 "om2pv2")
41 return 26
42 ;;
43 "om5p"|\
44 "om5p-an")
45 return 11
46 ;;
47 "om5p-ac")
48 return 17
49 ;;
50 esac
51 else
52 #we assume it is om1p in this case
53 return 3
54 fi
55
56 return 255
57 }
58
59 start_service() {
60 get_gpio
61 gpio="$?"
62 [ "$gpio" != "255" ] || return
63
64 procd_open_instance
65 procd_set_param command "${PROG}" "${gpio}"
66 procd_set_param respawn
67 procd_close_instance
68 }