packages-update: support passing backup failure

This commit is contained in:
Christian Hesse 2024-03-08 09:19:43 +01:00
parent ffa31c7ad7
commit 3fcdd395fe

View file

@ -23,6 +23,7 @@
:global VersionToNum; :global VersionToNum;
:global PackagesUpdateDeferReboot; :global PackagesUpdateDeferReboot;
:global PackagesUpdateBackupFailure;
:local Schedule do={ :local Schedule do={
:local ScriptName [ :tostr $1 ]; :local ScriptName [ :tostr $1 ];
@ -96,10 +97,15 @@
} }
:foreach Order,Script in=$RunOrder do={ :foreach Order,Script in=$RunOrder do={
:set PackagesUpdateBackupFailure false;
:do { :do {
$LogPrintExit2 info $ScriptName ("Running backup script " . $Script . " before update.") false; $LogPrintExit2 info $ScriptName ("Running backup script " . $Script . " before update.") false;
/system/script/run $Script; /system/script/run $Script;
} on-error={ } on-error={
:set PackagesUpdateBackupFailure true;
}
:if ($PackagesUpdateBackupFailure = true) do={
$LogPrintExit2 warning $ScriptName ("Running backup script " . $Script . " before update failed!") false; $LogPrintExit2 warning $ScriptName ("Running backup script " . $Script . " before update failed!") false;
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={ :if ([ $ScriptFromTerminal $ScriptName ] = true) do={
:put "Do you want to continue anyway? [y/N]"; :put "Do you want to continue anyway? [y/N]";