From d0cdad791c937c48fe3598338599f678f1cd1e0d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 25 Feb 2021 16:31:19 +0100 Subject: global-functions: $ScriptInstallUpdate: swap conditions --- global-functions | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index 4b495d9..7dddb50 100644 --- a/global-functions +++ b/global-functions @@ -668,8 +668,8 @@ } :if ([ :len $SourceNew ] > 0) do={ - :if ([ :pick $SourceNew 0 18 ] = "#!rsc by RouterOS\n") do={ - :if ($SourceNew != $ScriptVal->"source") do={ + :if ($SourceNew != $ScriptVal->"source") do={ + :if ([ :pick $SourceNew 0 18 ] = "#!rsc by RouterOS\n") do={ :local DontRequirePermissions \ ($SourceNew~"\n# requires: dont-require-permissions=yes\n"); $LogPrintExit2 info $0 ("Updating script: " . $ScriptVal->"name") false; @@ -692,10 +692,11 @@ } } } else={ - $LogPrintExit2 debug $0 ("Script " . $ScriptVal->"name" . " did not change.") false; + $LogPrintExit2 warning $0 ("Looks like new script " . $ScriptVal->"name" . \ + " is not valid (missing shebang). Ignoring!") false; } } else={ - $LogPrintExit2 warning $0 ("Looks like new script " . $ScriptVal->"name" . " is not valid. Ignoring!") false; + $LogPrintExit2 debug $0 ("Script " . $ScriptVal->"name" . " did not change.") false; } } else={ $LogPrintExit2 debug $0 ("No update for script " . $ScriptVal->"name" . ".") false; -- cgit v1.2.3-70-g09d2