Fix OSUpdate bug due to API refactoring

This commit is contained in:
Thomas Farstrike
2025-07-07 19:00:28 +02:00
parent 7e220bf0e2
commit b0c4524ccc
3 changed files with 29 additions and 22 deletions
@@ -3,10 +3,10 @@
"publisher": "MicroPythonOS",
"short_description": "Operating System Updater",
"long_description": "Updates the operating system in a safe way, to a secondary partition. After the update, the device is restarted. If the system starts up successfully, it is marked as valid and kept. Otherwise, a rollback to the old, primary partition is performed.",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.3_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.3.mpk",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.4_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.4.mpk",
"fullname": "com.micropythonos.osupdate",
"version": "0.0.3",
"version": "0.0.4",
"category": "osupdate",
"activities": [
{
@@ -7,6 +7,7 @@ import _thread
from mpos.apps import Activity
import mpos.info
import mpos.ui
import mpos.ui.topmenu
class OSUpdate(Activity):
@@ -23,14 +24,14 @@ class OSUpdate(Activity):
self.main_screen = lv.obj()
self.main_screen.set_style_pad_all(mpos.ui.pct_of_display_width(2), 0)
self.install_button = lv.button(self.main_screen)
self.install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.NOTIFICATION_BAR_HEIGHT)
self.install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.topmenu.NOTIFICATION_BAR_HEIGHT)
self.install_button.add_state(lv.STATE.DISABLED) # button will be enabled if there is an update available
self.install_button.set_size(lv.SIZE_CONTENT, lv.pct(25))
install_label = lv.label(self.install_button)
install_label.set_text("Update OS")
install_label.center()
self.status_label = lv.label(self.main_screen)
self.status_label.align(lv.ALIGN.TOP_LEFT,0,mpos.ui.NOTIFICATION_BAR_HEIGHT)
self.status_label.align(lv.ALIGN.TOP_LEFT,0,mpos.ui.topmenu.NOTIFICATION_BAR_HEIGHT)
self.setContentView(self.main_screen)
def onStart(self, screen):
+23 -17
View File
@@ -14,6 +14,8 @@ mkdir -p "$output"
#rm "$output"/*.png
rm "$outputjson"
blacklist="com.micropythonos.filemanager com.example.bla"
echo "[" | tee -a "$outputjson"
# currently, this script doesn't purge unnecessary information from the manifests, such as activities
@@ -21,23 +23,27 @@ echo "[" | tee -a "$outputjson"
for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do
echo "Listing apps in $apprepo"
ls -1 "$apprepo" | while read appdir; do
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 | sort | TZ=CET zip -X -r0 "$mpkname" -@
cp res/mipmap-mdpi/icon_64x64.png "$thisappdir"/icons/"$appdir"_"$version"_64x64.png
popd
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 | sort | TZ=CET zip -X -r0 "$mpkname" -@
cp res/mipmap-mdpi/icon_64x64.png "$thisappdir"/icons/"$appdir"_"$version"_64x64.png
popd
fi
done
done