Files
MicroPythonOS/scripts/bundle_apps.sh
T

61 lines
2.0 KiB
Bash
Raw Normal View History

2025-10-09 19:49:53 +02:00
output=../apps/
2025-06-03 16:37:50 +02:00
outputjson="$output"/app_index.json
2025-05-07 13:47:55 +02:00
output=$(readlink -f "$output")
2025-05-07 16:11:32 +02:00
outputjson=$(readlink -f "$outputjson")
2025-06-03 16:37:50 +02:00
#mpks="$output"/mpks/
#icons="$output"/icons/
2025-05-07 16:11:32 +02:00
2025-06-03 16:37:50 +02:00
mkdir -p "$output"
#mkdir -p "$mpks"
#mkdir -p "$icons"
#rm "$output"/*.mpk
#rm "$output"/*.png
2025-05-07 16:11:32 +02:00
rm "$outputjson"
2025-11-12 11:56:16 +01:00
# These apps are for testing, or aren't ready yet:
# com.quasikili.quasidoodle doesn't work on touch screen devices
# com.micropythonos.filemanager doesn't do anything other than let you browse the filesystem, so it's confusing
2025-11-12 14:48:29 +01:00
# com.micropythonos.confetti crashes when closing
# com.micropythonos.showfonts is slow to open
blacklist="com.micropythonos.filemanager com.quasikili.quasidoodle com.micropythonos.confetti com.micropythonos.showfonts"
2025-07-07 19:00:28 +02:00
2025-05-07 16:11:32 +02:00
echo "[" | tee -a "$outputjson"
2025-05-07 13:47:55 +02:00
2025-06-04 15:32:16 +02:00
# currently, this script doesn't purge unnecessary information from the manifests, such as activities
2025-11-07 14:33:58 +01:00
#for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do
for apprepo in internal_filesystem/apps; do
2025-06-28 08:59:59 +02:00
echo "Listing apps in $apprepo"
ls -1 "$apprepo" | sort | while read appdir; do
2025-07-07 19:00:28 +02:00
if echo "$blacklist" | grep "$appdir"; then
echo "Skipping $appdir because it's in blacklist $blacklist"
else
echo "Bundling $apprepo/$appdir"
pushd "$apprepo"/"$appdir"
manifest=META-INF/MANIFEST.JSON
version=$( jq -r '.version' "$manifest" )
cat "$manifest" | tee -a "$outputjson"
echo -n "," | tee -a "$outputjson"
thisappdir="$output"/apps/"$appdir"
mkdir -p "$thisappdir"
mkdir -p "$thisappdir"/mpks
mkdir -p "$thisappdir"/icons
mpkname="$thisappdir"/mpks/"$appdir"_"$version".mpk
echo "Setting file modification times to a fixed value..."
find . -type f -exec touch -t 202501010000.00 {} \;
echo "Creating $mpkname with deterministic file order..."
find . -type f | grep -v ".git/" | sort | TZ=CET zip -X -r0 "$mpkname" -@
2025-07-07 19:00:28 +02:00
cp res/mipmap-mdpi/icon_64x64.png "$thisappdir"/icons/"$appdir"_"$version"_64x64.png
popd
fi
2025-06-28 08:59:59 +02:00
done
done
2025-05-07 16:11:32 +02:00
# remove the last , to have valid json:
truncate -s -1 "$outputjson"
echo "]" | tee -a "$outputjson"