blob: 9d9ec57de3f06cb83e4faba6f4b8cbf59187c84f [file] [log] [blame]
Stewart Smithb2bcc832015-08-20 13:38:33 +10001#!/bin/sh
2
3LOGFILE=/var/log/petitboot/pb-discover.log
4PIDFILE=/var/run/petitboot.pid
5
6PATH=/usr/bin:/usr/sbin:/bin:/sbin
7export PATH
8
9verbose=
10if pb-config debug | grep -q enabled
11then
12 verbose=-v
13fi
14
15case "$1" in
16 start)
17 ulimit -c unlimited
Samuel Mendoza-Jonasdb6ca352018-11-26 11:47:43 +110018 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 Kerrd7af67c2015-09-24 15:02:03 +100024 export $(cat /etc/locale)
Stewart Smithb2bcc832015-08-20 13:38:33 +100025 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 ;;
36esac
37
38exit 0