mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
script-updates: make sure new script starts with magic
This commit is contained in:
parent
be673737d3
commit
5303c034b9
1 changed files with 9 additions and 5 deletions
|
@ -50,12 +50,16 @@
|
|||
}
|
||||
|
||||
:if ([ :len $sourcenew ] > 0) do={
|
||||
:local sourcecurrent [ / system script get $script source ];
|
||||
:if ($sourcenew = $sourcecurrent) do={
|
||||
:log debug ("Script " . $scriptname . " did not change");
|
||||
:if ([ :pick $sourcenew 0 5 ] = "#!rsc") do={
|
||||
:local sourcecurrent [ / system script get $script source ];
|
||||
:if ($sourcenew != $sourcecurrent) do={
|
||||
:log info ("Updating script: " . $scriptname);
|
||||
/ system script set owner=$scriptname source=$sourcenew $script;
|
||||
} else={
|
||||
:log debug ("Script " . $scriptname . " did not change");
|
||||
}
|
||||
} else={
|
||||
:log info ("Updating script: " . $scriptname);
|
||||
/ system script set owner=$scriptname source=$sourcenew $script;
|
||||
:log warning ("Looks like new script " . $scriptname . " is not valid. Ignoring!");
|
||||
}
|
||||
} else={
|
||||
:log debug ("No update for script " . $scriptname);
|
||||
|
|
Loading…
Reference in a new issue