mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-routeros-update: drop main function, use :do with on-error
This commit is contained in:
parent
b78556ca41
commit
7110b29cba
1 changed files with 7 additions and 9 deletions
|
@ -11,8 +11,8 @@
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:local Main do={
|
:do {
|
||||||
:local ScriptName [ :tostr $1 ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global SafeUpdateAll;
|
:global SafeUpdateAll;
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:return false;
|
:error false;
|
||||||
}
|
}
|
||||||
$WaitFullyConnected;
|
$WaitFullyConnected;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
:if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
|
:if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
|
||||||
$LogPrintExit2 info $ScriptName ("System is already up to date.") false;
|
$LogPrintExit2 info $ScriptName ("System is already up to date.") false;
|
||||||
:return true;
|
:error true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
|
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
|
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
|
||||||
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS update notification for version " . \
|
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS update notification for version " . \
|
||||||
$Update->"latest-version" . ".") false;
|
$Update->"latest-version" . ".") false;
|
||||||
:return true;
|
:error true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
|
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
|
||||||
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
|
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
|
||||||
$Update->"latest-version" . ".") false;
|
$Update->"latest-version" . ".") false;
|
||||||
:return true;
|
:error true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
|
@ -160,6 +160,4 @@
|
||||||
" is available for downgrade.") false;
|
" is available for downgrade.") false;
|
||||||
:set SentRouterosUpdateNotification ($Update->"latest-version");
|
:set SentRouterosUpdateNotification ($Update->"latest-version");
|
||||||
}
|
}
|
||||||
}
|
} on-error={ }
|
||||||
|
|
||||||
$Main [ :jobname ];
|
|
||||||
|
|
Loading…
Reference in a new issue