om-watchdog: Move each board name to its own line
[openwrt/openwrt.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 "om2p" | \
20 "om2p-hs" | \
21 "om2p-hsv2")
22 return 12
23 ;;
24 "om2pv2" | \
25 "om2p-lc")
26 return 26
27 ;;
28 "om5p" | \
29 "om5p-an")
30 return 11
31 ;;
32 "mr600v2")
33 return 15
34 ;;
35 "mr900" | \
36 "mr900v2" | \
37 "mr1750")
38 return 16
39 ;;
40 esac
41 else
42 #we assume it is om1p in this case
43 return 3
44 fi
45
46 return 255
47 }
48
49 start_service() {
50 get_gpio
51 gpio="$?"
52 [ "$gpio" != "255" ] || return
53
54 procd_open_instance
55 procd_set_param command "${PROG}" "${gpio}"
56 procd_set_param respawn
57 procd_close_instance
58 }