-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·101 lines (78 loc) · 3 KB
/
install.sh
File metadata and controls
executable file
·101 lines (78 loc) · 3 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Bash is used for pushd and popd
mydir=$(readlink -f "$0")
mydir=$(dirname "$mydir")
pkill -f "python.*mpremote"
appname="$1"
echo "This script will install the important files from internal_filesystem/ on the device using mpremote.py"
echo
echo "Usage: $0 [appname]"
echo "Example: $0"
echo "Example: $0 com.micropythonos.about"
mpremote=$(readlink -f "$mydir/../lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py")
pushd "$mydir"/../internal_filesystem/
# Maybe also do: import mpos ; mpos.TaskManager.stop()
echo "Disabling wifi because it writes to REPL from time to time when doing disconnect/reconnect for ADC2..."
$mpremote exec "import mpos ; mpos.net.wifi_service.WifiService.disconnect()"
sleep 2
if [ ! -z "$appname" ]; then
echo "Installing one app: $appname"
appdir="apps/$appname"
target="apps/"
if [ ! -d "$appdir" ]; then
echo "$appdir doesn't exist so taking the builtin/"
appdir="builtin/apps/$appname/"
target="builtin/apps/"
if [ ! -d "$appdir" ]; then
echo "$appdir also doesn't exist, exiting..."
exit 1
fi
fi
$mpremote mkdir "/apps"
#$mpremote mkdir "/builtin" # dont do this because it breaks the mount!
#$mpremote mkdir "/builtin/apps"
if test -L "$appdir"; then
$mpremote fs mkdir :/"$appdir"
$mpremote fs cp -r "$appdir"/* :/"$appdir"/
else
$mpremote fs cp -r "$appdir" :/"$target"
fi
echo "start_app(\"/$appdir\")"
$mpremote
popd
exit
fi
# boot.py is not copied because it can't be overridden anyway
# The issue is that this brings all the .git folders with it:
#$mpremote fs cp -r apps :/
$mpremote fs cp -r lib :/
#echo "Unmounting builtin/ so that it can be customized..." # not sure this is necessary
#$mpremote exec "import os ; os.umount('/builtin')"
$mpremote fs cp -r builtin :/
#$mpremote fs cp -r data :/
#$mpremote fs cp -r data/images :/data/
$mpremote fs mkdir :/data
$mpremote fs mkdir :/data/com.micropythonos.system.wifiservice
$mpremote fs cp ../internal_filesystem_excluded/data/com.micropythonos.system.wifiservice/config.json :/data/com.micropythonos.system.wifiservice/
$mpremote fs mkdir :/apps
# Use this to install just a few apps:
#$mpremote fs cp -r apps/com.micropythonos.musicplayer :/apps/
#$mpremote fs cp -r apps/com.micropythonos.soundrecorder :/apps/
#$mpremote fs cp -r apps/com.micropythonos.breakout :/apps/
if [ ! -z "$appname" ]; then
echo "Not resetting so the installed app can be used immediately."
$mpremote reset
fi
# Uncomment this line if you really want all apps the be installed:
echo "Not installing all apps by default because it takes a long time, uses lots of storage and makes the boot slower..." ; popd ; exit 1
$mpremote fs cp -r apps/com.micropythonos.* :/apps/
find apps/ -maxdepth 1 -type l | while read symlink; do
if echo $symlink | grep quasiboats; then
echo "Skipping $symlink because it's needlessly big..."
continue
fi
echo "Handling symlink $symlink"
$mpremote fs mkdir :/"$symlink"
$mpremote fs cp -r "$symlink"/* :/"$symlink"/
done
popd