Stewart Smith | b2bcc83 | 2015-08-20 13:38:33 +1000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | LOGFILE=/var/log/petitboot/pb-discover.log |
| 4 | PIDFILE=/var/run/petitboot.pid |
| 5 | |
| 6 | PATH=/usr/bin:/usr/sbin:/bin:/sbin |
| 7 | export PATH |
| 8 | |
| 9 | verbose= |
| 10 | if pb-config debug | grep -q enabled |
| 11 | then |
| 12 | verbose=-v |
| 13 | fi |
| 14 | |
| 15 | case "$1" in |
| 16 | start) |
| 17 | ulimit -c unlimited |
Samuel Mendoza-Jonas | db6ca35 | 2018-11-26 11:47:43 +1100 | [diff] [blame] | 18 | mkdir -p -m 0775 $(dirname $LOGFILE) |
| 19 | mkdir -p -m 0775 /var/petitboot |
| 20 | # Set permissions for normal users |
| 21 | chown -R root:petitgroup $(dirname $LOGFILE) |
| 22 | chown -R root:petitgroup /var/petitboot |
| 23 | |
Jeremy Kerr | d7af67c | 2015-09-24 15:02:03 +1000 | [diff] [blame] | 24 | export $(cat /etc/locale) |
Stewart Smith | b2bcc83 | 2015-08-20 13:38:33 +1000 | [diff] [blame] | 25 | pb-discover -l $LOGFILE $verbose & |
| 26 | echo $! > $PIDFILE |
| 27 | ;; |
| 28 | stop) |
| 29 | pid=$(cat $PIDFILE) |
| 30 | [ -n "$pid" ] && kill -TERM $pid |
| 31 | ;; |
| 32 | *) |
| 33 | echo "Usage: $0 {start|stop}" |
| 34 | exit 1 |
| 35 | ;; |
| 36 | esac |
| 37 | |
| 38 | exit 0 |