-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
38 lines (26 loc) · 1.01 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
echo 'Starting Figure app'
# Enable I2C. See http://docs.resin.io/#/pages/i2c-and-spi.md for more details
modprobe i2c-dev
# create data directories
mkdir -p /data/static /data/media/tickets /data/media/images /data/media/pictures
# Make sure $HOSTNAME is present in /etc/hosts
grep -q "$HOSTNAME" /etc/hosts || echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
mkdir -p /data/log && touch /data/log/figure.log && touch /data/log/wifi-connect.log
# Start Xvfb
/etc/init.d/xvfb start
# Start Wifi Access Point if WIFI_ON
if [ "$WIFI_ON" = 1 ]; then
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
node /usr/src/app/resin-wifi-connect/src/app.js --clear=false >> /data/log/wifi-connect.log 2>&1 &
fi
if [ -f /var/run/supervisor.sock ]
then
unlink /var/run/supervisor.sock
fi
# mount RAM disk
mkdir -p /mnt/ramdisk
mount -t tmpfs -o size=2m tmpfs /mnt/ramdisk
# Launch supervisor in the foreground
echo 'Starting supervisor'
supervisord --nodaemon --configuration /etc/supervisord.conf