-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush.sh
executable file
·49 lines (44 loc) · 1.12 KB
/
push.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
DEVICE='/dev/ttyUSB0'
Json='false'
DFLAG='false'
while getopts 'jf:' flag
do
case "${flag}" in
f)
DEVICE=$OPTARG
DFLAG='true'
;;
j) Json='true' ;;
?)
echo "Bad arguments supplied"
echo "Run as push.sh <-j> -f [DEVICE_HANDLE]"
exit 1
;;
esac
done
shift "$(($OPTIND -1))"
if [ "$Json" = true ]
then
echo "Pushing tokens.json to $DEVICE"
ampy --port $DEVICE put tokens.json
else
echo "skipped tokens.json"
fi
if [ "$DFLAG" = false ]
then
echo "No device supplied"
echo "Running with default device handle of $DEVICE"
fi
echo "Starting copy to $DEVICE"
ampy --port $DEVICE put funcs.py
ampy --port $DEVICE put api.py
ampy --port $DEVICE put pixel.py
ampy --port $DEVICE put blinkers.py
# ampy --port $DEVICE put tokens.json # Uncomment first time you push, then re-comment
# alternatively you can hand-run that command once
ampy --port $DEVICE put main.py
ampy --port $DEVICE put spectre.py
ampy --port $DEVICE put secrets.py
# echo "Now copying primitives... may take a while"
# ampy --port $DEVICE put primitives