diff options
author | Christian Hesse <mail@eworm.de> | 2020-02-26 14:19:54 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-02-26 14:19:54 +0100 |
commit | ceaa83b83edb069ecf1cca181ec461519f0cc020 (patch) | |
tree | 1c48dd40fcdc3cd59a184a81acf8e6161e98d159 /packages-update | |
parent | 6036edb506a7101d95eb293d0509b4ff178d7191 (diff) |
global-functions: merge $LogAnd{Error,Put} to $LogPrintExit ...
... and fix logging.
Logging with severity from variable (:log $severity ...) is not
possible, this is considered a syntax error. Also the 'workaround' with
parsing code failed with missing message in log.
The reliable code is a lot longer, so merge the two functions to save a
lot of duplicate code.
Diffstat (limited to 'packages-update')
-rw-r--r-- | packages-update | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages-update b/packages-update index d57ee5d..b364b18 100644 --- a/packages-update +++ b/packages-update @@ -7,24 +7,24 @@ :global DownloadPackage; :global ScriptFromTerminal; :global ScriptLock; -:global LogAndError; +:global LogPrintExit; $ScriptLock "packages-update"; :local Update [ / system package update get ]; :if ([ :typeof ($Update->"latest-version") ] = "nothing") do={ - $LogAndError warning "Latest version is not known."; + $LogPrintExit warning "Latest version is not known." true; } :if ($Update->"installed-version" = $Update->"latest-version") do={ - $LogAndError info ("Version " . $Update->"latest-version" . " is already installed."); + $LogPrintExit info ("Version " . $Update->"latest-version" . " is already installed.") true; } :foreach Package in=[ / system package find where !bundle ] do={ :local PkgName [ / system package get $Package name ]; if ([ $DownloadPackage $PkgName ($Update->"latest-version") ] = false) do={ - $LogAndError error ("Download for package " . $PkgName . " failed."); + $LogPrintExit error ("Download for package " . $PkgName . " failed.") true; } } @@ -47,7 +47,7 @@ $ScriptLock "packages-update"; / system scheduler add name="reboot-for-update" start-time=03:00:00 interval=1d \ on-event=(":global RandomDelay; \$RandomDelay 3600; " . \ "/ system scheduler remove reboot-for-update; / system reboot;"); - $LogAndError info ("Scheduled reboot for update between 03:00 and 04:00."); + $LogPrintExit info ("Scheduled reboot for update between 03:00 and 04:00.") true; } } |