Skip to content

Commit b0c4524

Browse files
Fix OSUpdate bug due to API refactoring
1 parent 7e220bf commit b0c4524

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

internal_filesystem/builtin/apps/com.micropythonos.osupdate/META-INF/MANIFEST.JSON

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"publisher": "MicroPythonOS",
44
"short_description": "Operating System Updater",
55
"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.",
6-
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.3_64x64.png",
7-
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.3.mpk",
6+
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.4_64x64.png",
7+
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.4.mpk",
88
"fullname": "com.micropythonos.osupdate",
9-
"version": "0.0.3",
9+
"version": "0.0.4",
1010
"category": "osupdate",
1111
"activities": [
1212
{

internal_filesystem/builtin/apps/com.micropythonos.osupdate/assets/osupdate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from mpos.apps import Activity
88
import mpos.info
99
import mpos.ui
10+
import mpos.ui.topmenu
1011

1112

1213
class OSUpdate(Activity):
@@ -23,14 +24,14 @@ def onCreate(self):
2324
self.main_screen = lv.obj()
2425
self.main_screen.set_style_pad_all(mpos.ui.pct_of_display_width(2), 0)
2526
self.install_button = lv.button(self.main_screen)
26-
self.install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.NOTIFICATION_BAR_HEIGHT)
27+
self.install_button.align(lv.ALIGN.TOP_RIGHT, 0, mpos.ui.topmenu.NOTIFICATION_BAR_HEIGHT)
2728
self.install_button.add_state(lv.STATE.DISABLED) # button will be enabled if there is an update available
2829
self.install_button.set_size(lv.SIZE_CONTENT, lv.pct(25))
2930
install_label = lv.label(self.install_button)
3031
install_label.set_text("Update OS")
3132
install_label.center()
3233
self.status_label = lv.label(self.main_screen)
33-
self.status_label.align(lv.ALIGN.TOP_LEFT,0,mpos.ui.NOTIFICATION_BAR_HEIGHT)
34+
self.status_label.align(lv.ALIGN.TOP_LEFT,0,mpos.ui.topmenu.NOTIFICATION_BAR_HEIGHT)
3435
self.setContentView(self.main_screen)
3536

3637
def onStart(self, screen):

scripts/bundleapps.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,36 @@ mkdir -p "$output"
1414
#rm "$output"/*.png
1515
rm "$outputjson"
1616

17+
blacklist="com.micropythonos.filemanager com.example.bla"
18+
1719
echo "[" | tee -a "$outputjson"
1820

1921
# currently, this script doesn't purge unnecessary information from the manifests, such as activities
2022

2123
for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do
2224
echo "Listing apps in $apprepo"
2325
ls -1 "$apprepo" | while read appdir; do
24-
echo "Bundling $apprepo/$appdir"
25-
pushd "$apprepo"/"$appdir"
26-
manifest=META-INF/MANIFEST.JSON
27-
version=$( jq -r '.version' "$manifest" )
28-
cat "$manifest" | tee -a "$outputjson"
29-
echo -n "," | tee -a "$outputjson"
30-
thisappdir="$output"/apps/"$appdir"
31-
mkdir -p "$thisappdir"
32-
mkdir -p "$thisappdir"/mpks
33-
mkdir -p "$thisappdir"/icons
34-
mpkname="$thisappdir"/mpks/"$appdir"_"$version".mpk
35-
echo "Setting file modification times to a fixed value..."
36-
find . -type f -exec touch -t 202501010000.00 {} \;
37-
echo "Creating $mpkname with deterministic file order..."
38-
find . -type f | sort | TZ=CET zip -X -r0 "$mpkname" -@
39-
cp res/mipmap-mdpi/icon_64x64.png "$thisappdir"/icons/"$appdir"_"$version"_64x64.png
40-
popd
26+
if echo "$blacklist" | grep "$appdir"; then
27+
echo "Skipping $appdir because it's in blacklist $blacklist"
28+
else
29+
echo "Bundling $apprepo/$appdir"
30+
pushd "$apprepo"/"$appdir"
31+
manifest=META-INF/MANIFEST.JSON
32+
version=$( jq -r '.version' "$manifest" )
33+
cat "$manifest" | tee -a "$outputjson"
34+
echo -n "," | tee -a "$outputjson"
35+
thisappdir="$output"/apps/"$appdir"
36+
mkdir -p "$thisappdir"
37+
mkdir -p "$thisappdir"/mpks
38+
mkdir -p "$thisappdir"/icons
39+
mpkname="$thisappdir"/mpks/"$appdir"_"$version".mpk
40+
echo "Setting file modification times to a fixed value..."
41+
find . -type f -exec touch -t 202501010000.00 {} \;
42+
echo "Creating $mpkname with deterministic file order..."
43+
find . -type f | sort | TZ=CET zip -X -r0 "$mpkname" -@
44+
cp res/mipmap-mdpi/icon_64x64.png "$thisappdir"/icons/"$appdir"_"$version"_64x64.png
45+
popd
46+
fi
4147
done
4248
done
4349

0 commit comments

Comments
 (0)