backup-upload: early exit with :exit

This commit is contained in:
Christian Hesse 2026-01-19 15:01:49 +01:00
parent 6f1f60a82b
commit 98bd011984

View file

@ -10,7 +10,6 @@
# create and upload backup and config file
# https://rsc.eworm.de/doc/backup-upload.md
:local ExitOK false;
:onerror Err {
:global GlobalConfigReady; :global GlobalFunctionsReady;
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
@ -47,21 +46,18 @@
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
$LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
:set ExitOK true;
:error false;
:exit;
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
:exit;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
:exit;
}
$WaitFullyConnected;
@ -81,8 +77,7 @@
:if ([ $MkDir $DirName ] = false) do={
$LogPrint error $ScriptName ("Failed creating directory!");
:set ExitOK true;
:error false;
:exit;
}
# binary backup
@ -174,5 +169,5 @@
}
$RmDir $DirName;
} do={
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
:global ExitError; $ExitError false [ :jobname ] $Err;
}