-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-on-device-fs
executable file
·55 lines (41 loc) · 1.03 KB
/
install-on-device-fs
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
#!/usr/bin/env bash
DEVICES=$(mpremote connect list | grep MicroPython | cut -d " " -f 1)
if [ -z $DEVICES ] ; then
echo "No MicroPython devices found in FS mode"
exit 1
fi
DEVICE=${DEVICES[0]}
echo "Copying Enviro firmware files to ${DEVICE}"
function create_directory {
echo -n "> creating directory $1"
RESULT=$(mpremote connect ${DEVICE} mkdir $1)
ERROR=$?
if [ $ERROR -eq 0 ] ; then
echo " .. done!"
else
if [[ "$RESULT" == *"EEXIST"* ]] ; then
echo " .. already exists, skipping."
else
echo " .. failed!"
echo "! it looks like this device is already in use - is Thonny running?"
exit 1
fi
fi
}
function copy {
for file in $1
do
echo -n "> copying file $file"
mpremote connect ${DEVICE} cp $file $2 > /dev/null
if [ $? -eq 0 ] ; then
echo " .. done!"
else
echo " .. failed!"
fi
done
}
create_directory enviroble
create_directory enviroble/boards
copy "main.py" :
copy "enviroble/*.py" :enviroble/
copy "enviroble/boards/*.py" :enviroble/boards/