Files
MicroPythonOS/scripts/install.sh
T

97 lines
2.8 KiB
Bash
Raw Normal View History

2025-10-27 21:30:09 +01:00
mydir=$(readlink -f "$0")
mydir=$(dirname "$mydir")
2025-04-22 13:34:38 +02:00
pkill -f "python.*mpremote"
2025-11-22 11:02:23 +01:00
appname="$1"
2025-10-08 17:52:48 +02:00
2025-11-22 11:02:23 +01:00
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"
2025-10-08 17:52:48 +02:00
2025-10-27 21:30:09 +01:00
mpremote=$(readlink -f "$mydir/../lvgl_micropython/lib/micropython/tools/mpremote/mpremote.py")
2025-06-15 10:25:38 +02:00
2026-02-05 10:49:46 +01:00
pushd "$mydir"/../internal_filesystem/
2025-04-25 15:08:49 +02:00
2025-12-12 09:58:25 +01:00
# Maybe also do: import mpos ; mpos.TaskManager.stop()
2025-11-24 22:08:35 +01:00
echo "Disabling wifi because it writes to REPL from time to time when doing disconnect/reconnect for ADC2..."
2025-12-12 09:58:25 +01:00
$mpremote exec "import mpos ; mpos.net.wifi_service.WifiService.disconnect()"
2025-11-24 22:08:35 +01:00
sleep 2
2025-05-07 10:38:40 +02:00
if [ ! -z "$appname" ]; then
echo "Installing one app: $appname"
appdir="apps/$appname"
2025-05-07 16:10:55 +02:00
target="apps/"
2025-05-07 10:38:40 +02:00
if [ ! -d "$appdir" ]; then
echo "$appdir doesn't exist so taking the builtin/"
2025-06-02 19:52:27 +02:00
appdir="builtin/apps/$appname/"
2025-05-07 16:10:55 +02:00
target="builtin/apps/"
2025-05-07 10:38:40 +02:00
if [ ! -d "$appdir" ]; then
echo "$appdir also doesn't exist, exiting..."
exit 1
fi
fi
2025-06-15 10:25:38 +02:00
$mpremote mkdir "/apps"
2025-11-23 22:57:49 +01:00
#$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
2025-05-07 10:38:40 +02:00
echo "start_app(\"/$appdir\")"
2025-06-15 10:25:38 +02:00
$mpremote
2025-05-07 10:38:40 +02:00
popd
exit
fi
2025-11-22 11:02:23 +01:00
# boot.py is not copied because it can't be overridden anyway
2025-04-22 11:54:36 +02:00
2025-11-12 15:54:53 +01:00
# The issue is that this brings all the .git folders with it:
#$mpremote fs cp -r apps :/
2025-11-07 14:33:58 +01:00
$mpremote fs cp -r lib :/
2025-11-07 14:33:58 +01:00
2025-11-22 11:19:35 +01:00
#echo "Unmounting builtin/ so that it can be customized..." # not sure this is necessary
#$mpremote exec "import os ; os.umount('/builtin')"
2025-06-15 10:25:38 +02:00
$mpremote fs cp -r builtin :/
2025-06-15 10:25:38 +02:00
#$mpremote fs cp -r data :/
#$mpremote fs cp -r data/images :/data/
2025-04-21 11:37:30 +02:00
$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/
2025-12-24 11:27:05 +01:00
$mpremote fs mkdir :/apps
2026-02-24 16:39:26 +01:00
$mpremote fs cp -r apps/com.micropythonos.musicplayer :/apps/
$mpremote fs cp -r apps/com.micropythonos.soundrecorder :/apps/
exit 1
2025-12-24 11:27:05 +01:00
$mpremote fs cp -r apps/com.micropythonos.* :/apps/
find apps/ -maxdepth 1 -type l | while read symlink; do
2026-02-10 08:53:13 +01:00
if echo $symlink | grep quasiboats; then
echo "Skipping $symlink because it's needlessly big..."
continue
fi
2025-12-24 11:27:05 +01:00
echo "Handling symlink $symlink"
$mpremote fs mkdir :/"$symlink"
$mpremote fs cp -r "$symlink"/* :/"$symlink"/
done
2025-04-25 15:08:49 +02:00
popd
2025-11-14 14:32:59 +01:00
# Install test infrastructure (for running ondevice tests)
echo "Installing test infrastructure..."
$mpremote fs mkdir :/tests
$mpremote fs mkdir :/tests/screenshots
2025-11-22 11:02:23 +01:00
if [ ! -z "$appname" ]; then
echo "Not resetting so the installed app can be used immediately."
$mpremote reset
fi