forked from davecrump/winterhill
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstartup.sh
executable file
·50 lines (41 loc) · 1.66 KB
/
startup.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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Used to check the PICS are programmed and set the startup behaviour on boot
#### PIC Programming ####
# Check whether programmed and, if not, program them
cd /home/pi/winterhill/whsource-3v20/whpicprog-3v20
sudo ./whpicprog-3v20 --check >/dev/null 2>/dev/null
PIC_RETURN=$?
if [ "$PIC_RETURN" != 34 ] && [ "$PIC_RETURN" != 18 ]; then # Not programmed correctly
echo Attempting to Program both PICs
sudo ./whpicprog-3v20 whpic-3v20.hex
echo Complete, starting WinterHill
echo
sleep 1
fi
cd /home/pi
#### Now Start WinterHill as set in the winterhill.ini file ####
grep -q 'BOOT = local' winterhill/winterhill.ini
if [ $? == 0 ]; then
lxterminal -t "whlaunch-local-3v20.sh" --working-directory=/home/pi/winterhill/RPi-3v20/ -e ./whlaunch-local-3v20.sh
else
grep -q 'BOOT = anyhub' winterhill/winterhill.ini
if [ $? == 0 ]; then
lxterminal -t "whlaunch-anyhub-3v20.sh" --working-directory=/home/pi/winterhill/RPi-3v20/ -e ./whlaunch-anyhub-3v20.sh
else
grep -q 'BOOT = anywhere' winterhill/winterhill.ini
if [ $? == 0 ]; then
lxterminal -t "whlaunch-anywhere-3v20.sh" --working-directory=/home/pi/winterhill/RPi-3v20/ -e ./whlaunch-anywhere-3v20.sh
else
grep -q 'BOOT = multihub' winterhill/winterhill.ini
if [ $? == 0 ]; then
lxterminal -t "whlaunch-multihub-3v20.sh" --working-directory=/home/pi/winterhill/RPi-3v20/ -e ./whlaunch-multihub-3v20.sh
else
grep -q 'BOOT = fixed' winterhill/winterhill.ini
if [ $? == 0 ]; then
lxterminal -t "whlaunch-fixed-3v20.sh" --working-directory=/home/pi/winterhill/RPi-3v20/ -e ./whlaunch-fixed-3v20.sh
fi
fi
fi
fi
fi
exit