-
Notifications
You must be signed in to change notification settings - Fork 1
/
provision.sh
executable file
·55 lines (49 loc) · 1.36 KB
/
provision.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
50
51
52
53
54
55
#!/bin/bash
args=("$@")
if [ -z "${args[0]}" ]; then
echo "Please provide a tracker callsign"
exit 1
fi
if [ -z "${args[1]}" ]; then
echo "Please provide an error messages callsign"
exit 1
fi
DIR="/Volumes/RPI-RP2"
if [ -d "$DIR" ]; then
echo "Installing firmwire to pico in ${DIR}..."
cd /tmp
wget https://downloads.circuitpython.org/bin/rfguru_rp2040/en_US/adafruit-circuitpython-rfguru_rp2040-en_US-9.1.4.uf2
cp adafruit-circuitpython-rfguru_rp2040-en_US-9.1.4.uf2 /Volumes/RPI-RP2
rm adafruit-circuitpython-rfguru_rp2040-en_US-9.1.4.uf2
echo "Sleeping 20 seconds for firmware to install"
cd -
sleep 20
fi
DIR="/Volumes/CIRCUITPY"
if [ -d "$DIR" ]; then
echo "Install software in ${DIR}..."
cp -r lib /Volumes/CIRCUITPY
cp boot.py /Volumes/CIRCUITPY
echo "1" > /Volumes/CIRCUITPY/sequence
cp config.py /tmp
perl -i -pe "s/--CALL--/${args[0]}/g" /tmp/config.py
perl -i -pe "s/--MSGS--/${args[1]}/g" /tmp/config.py
cp -f /tmp/config.py /Volumes/CIRCUITPY
cp code.py /Volumes/CIRCUITPY
rm -f /tmp/config.py
sync
diskutil unmount /Volumes/CIRCUITPY
echo "done"
fi
DIR="/Volumes/APRSTRKR"
if [ -d "$DIR" ]; then
echo "Updating software in ${DIR}..."
unlink /Volumes/APRSTRKR/ro
sync
cp -r lib /Volumes/APRSTRKR
cp boot.py /Volumes/APRSTRKR
cp code.py /Volumes/APRSTRKR
sync
diskutil unmount /Volumes/APRSTRKR
echo "done"
fi