aboutsummaryrefslogtreecommitdiffstats
path: root/backup-partition.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-05-22 12:03:53 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-05-23 12:11:41 +0200
commitaffa11816182fa2bff454b3e82df3166c6cdd744 (patch)
tree82fb7afacf8f04b1d6381025d0ecf21f596d7eb1 /backup-partition.rsc
parent6cbe13a135fe39c097b6a7078506d99eedde2e06 (diff)
backup-partition: support copy before feature update
Diffstat (limited to 'backup-partition.rsc')
-rw-r--r--backup-partition.rsc13
1 files changed, 13 insertions, 0 deletions
diff --git a/backup-partition.rsc b/backup-partition.rsc
index a72dd0b..3c883f7 100644
--- a/backup-partition.rsc
+++ b/backup-partition.rsc
@@ -15,11 +15,13 @@
:do {
:local ScriptName [ :jobname ];
+ :global BackupPartitionCopyBeforeFeatureUpdate;
:global PackagesUpdateBackupFailure;
:global LogPrint;
:global ScriptFromTerminal;
:global ScriptLock;
+ :global VersionToNum;
:local CopyTo do={
:local ScriptName [ :tostr $1 ];
@@ -67,6 +69,17 @@
:error false;
}
}
+ } else={
+ :local Update [ /system/package/update/get ];
+ :local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
+ :local NumLatest [ $VersionToNum ($Update->"latest-version") ];
+ :if ($BackupPartitionCopyBeforeFeatureUpdate = true && $NumLatest > 0 && \
+ ($NumInstalled & 0xffff0000) != ($NumLatest & 0xffff0000)) do={
+ :if ([ $CopyTo $ScriptName $FallbackTo ] = false) do={
+ :set PackagesUpdateBackupFailure true;
+ :error false;
+ }
+ }
}
}