aboutsummaryrefslogtreecommitdiffstats
path: root/packages-update.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-07-03 16:35:39 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-07-04 15:31:43 +0200
commit64bc9f73f7ed24cfb7dec9f24fb101594ae4cb79 (patch)
treeec1f4c0e0d527bf10d677df73df8783732d5a229 /packages-update.rsc
parenteab9b28cd28b1d12d3f0d178db22acdac5ad1758 (diff)
packages-update: run backups before package download
This reduces memory pressure, especially on device with very limited RAM like mAP with its 64 MB.
Diffstat (limited to 'packages-update.rsc')
-rw-r--r--packages-update.rsc52
1 files changed, 26 insertions, 26 deletions
diff --git a/packages-update.rsc b/packages-update.rsc
index 0208b1e..97039ec 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -60,32 +60,6 @@
:error true;
}
- :local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
- :local NumLatest [ $VersionToNum ($Update->"latest-version") ];
-
- :local DoDowngrade false;
- :if ($NumInstalled > $NumLatest) do={
- :if ([ $ScriptFromTerminal $ScriptName ] = true) do={
- :put "Latest version is older than installed one. Want to downgrade? [y/N]";
- :if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
- :set DoDowngrade true;
- } else={
- :put "Canceled...";
- }
- } else={
- $LogPrint warning $ScriptName ("Not installing downgrade automatically.");
- :error false;
- }
- }
-
- :foreach Package in=[ /system/package/find where !bundle ] do={
- :local PkgName [ /system/package/get $Package name ];
- :if ([ $DownloadPackage $PkgName ($Update->"latest-version") ] = false) do={
- $LogPrint error $ScriptName ("Download for package " . $PkgName . " failed, update aborted.");
- :error false;
- }
- }
-
:local RunOrder ({});
:foreach Script in=[ /system/script/find where source~("\n# provides: backup-script\\b") ] do={
:local ScriptVal [ /system/script/get $Script ];
@@ -120,6 +94,32 @@
}
}
+ :local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
+ :local NumLatest [ $VersionToNum ($Update->"latest-version") ];
+
+ :local DoDowngrade false;
+ :if ($NumInstalled > $NumLatest) do={
+ :if ([ $ScriptFromTerminal $ScriptName ] = true) do={
+ :put "Latest version is older than installed one. Want to downgrade? [y/N]";
+ :if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
+ :set DoDowngrade true;
+ } else={
+ :put "Canceled...";
+ }
+ } else={
+ $LogPrint warning $ScriptName ("Not installing downgrade automatically.");
+ :error false;
+ }
+ }
+
+ :foreach Package in=[ /system/package/find where !bundle ] do={
+ :local PkgName [ /system/package/get $Package name ];
+ :if ([ $DownloadPackage $PkgName ($Update->"latest-version") ] = false) do={
+ $LogPrint error $ScriptName ("Download for package " . $PkgName . " failed, update aborted.");
+ :error false;
+ }
+ }
+
:if ($DoDowngrade = true) do={
$LogPrint info $ScriptName ("Rebooting for downgrade.");
:delay 1s;