let ipkg fail when a package file to be installed is not found
[openwrt.git] / openwrt / package / p910nd / files / p910nd.init
1 #!/bin/sh
2
3 DEFAULT=/etc/default/p910nd
4 RUN_D=/var/run
5
6 _start() {
7  mkdir -p $RUN_D
8  [ -f $DEFAULT ] && (
9   while read port options; do
10    case "$port" in
11     ""|\#*)
12      continue;
13    esac
14    p910nd $options $port
15    if [ $? -ne 0 ]; then
16     exit 1
17    fi
18   done
19  ) < $DEFAULT
20  exit 0
21 }
22
23 _stop() {
24  [ -f $DEFAULT ] && (
25   while read port options; do
26    case "$port" in
27     ""|\#*)
28      continue;
29    esac
30    PID_F=$RUN_D/p910${port}d.pid
31    [ -f $PID_F ] && kill $(cat $PID_F)
32   done
33  ) < $DEFAULT
34 }
35
36 case $1 in
37  start)
38   _start
39   ;;
40  stop)
41   _stop
42   ;;
43  *)
44   echo "usage: $0 (start|stop)"
45   exit 1
46 esac
47 exit $?