aboutsummaryrefslogtreecommitdiffstats
path: root/backup-partition.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-12-06 10:28:30 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-12-09 11:49:50 +0100
commit95030b9b74db03cf67c4702c82bb1d1224c9690e (patch)
tree5308fa763f2437d0904e368c27ade14e190d8cdb /backup-partition.rsc
parent2c4053cff55a7d0a90f364f7aded280422dc1d65 (diff)
backup-partition: use $ExitError to indicate unintentional error
Diffstat (limited to 'backup-partition.rsc')
-rw-r--r--backup-partition.rsc12
1 files changed, 11 insertions, 1 deletions
diff --git a/backup-partition.rsc b/backup-partition.rsc
index 51df454..f1e1c17 100644
--- a/backup-partition.rsc
+++ b/backup-partition.rsc
@@ -12,6 +12,7 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
+:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
@@ -42,12 +43,14 @@
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
:if ([ :len [ /partitions/find ] ] < 2) do={
$LogPrint error $ScriptName ("Device does not have a fallback partition.");
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
@@ -56,6 +59,7 @@
:if ([ :len $ActiveRunning ] < 1) do={
$LogPrint error $ScriptName ("Device is not running from active partition.");
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
@@ -65,6 +69,7 @@
:if ([ :len $FallbackTo ] < 1) do={
$LogPrint error $ScriptName ("There is no inactive partition named '" . $FallbackToName . "'.");
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
@@ -74,6 +79,7 @@
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
}
@@ -86,6 +92,7 @@
($NumInstalled & $BitMask) != ($NumLatest & $BitMask)) do={
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
}
@@ -103,6 +110,9 @@
/system/scheduler/remove [ find where name="running-from-backup-partition" ];
$LogPrint error $ScriptName ("Failed saving configuration to partition '" . $FallbackToName . "'!");
:set PackagesUpdateBackupFailure true;
+ :set ExitOK true;
:error false;
}
-} on-error={ }
+} on-error={
+ :global ExitError; $ExitError $ExitOK [ :jobname ];
+}