mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-03-05 13:39:35 +00:00
Compare commits
1 commit
9f6ade4fe4
...
7462b0b1f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7462b0b1f0 |
2 changed files with 25 additions and 20 deletions
|
|
@ -272,9 +272,9 @@
|
|||
};
|
||||
|
||||
# load custom settings from overlay and snippets
|
||||
# /\ Warning: Do *NOT*
|
||||
# /\7\ copy this code
|
||||
# /_()_\ to overlay!
|
||||
# /\ Warning: Do *NOT*
|
||||
# /\7\ copy this code
|
||||
# /_()_\ to overlay!
|
||||
:foreach Script in=([ /system/script/find where name="global-config-overlay" ], \
|
||||
[ /system/script/find where name~"^global-config-overlay.d/" ]) do={
|
||||
:do {
|
||||
|
|
|
|||
|
|
@ -1126,8 +1126,6 @@
|
|||
:global CommitId;
|
||||
:global CommitInfo;
|
||||
:global ExpectedConfigVersion;
|
||||
:global GlobalConfigReady;
|
||||
:global GlobalFunctionsReady;
|
||||
:global Identity;
|
||||
:global IDonate;
|
||||
:global NoNewsAndChangesNotification;
|
||||
|
|
@ -1161,7 +1159,8 @@
|
|||
|
||||
:local CommitIdBefore $CommitId;
|
||||
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
|
||||
:local ReloadGlobal false;
|
||||
:local ReloadGlobalFunctions false;
|
||||
:local ReloadGlobalConfig false;
|
||||
:local DeviceMode [ /system/device-mode/get ];
|
||||
|
||||
:local CheckSums ({});
|
||||
|
|
@ -1270,25 +1269,31 @@
|
|||
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
|
||||
/system/script/set owner=($ScriptVal->"name") \
|
||||
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
|
||||
:if ($ScriptVal->"name" = "global-config" || \
|
||||
$ScriptVal->"name" = "global-functions" || \
|
||||
$ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobal true;
|
||||
:if ($ScriptVal->"name" = "global-config") do={
|
||||
:set ReloadGlobalConfig true;
|
||||
}
|
||||
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobalFunctions true;
|
||||
}
|
||||
} on-error={ }
|
||||
}
|
||||
|
||||
:if ($ReloadGlobal = true) do={
|
||||
$LogPrint info $0 ("Reloading global configuration and functions.");
|
||||
:set GlobalConfigReady false;
|
||||
:set GlobalFunctionsReady false;
|
||||
:delay 1s;
|
||||
|
||||
:onerror Err {
|
||||
/system/script/run global-config;
|
||||
:if ($ReloadGlobalFunctions = true) do={
|
||||
$LogPrint info $0 ("Reloading global functions.");
|
||||
:do {
|
||||
/system/script/run global-functions;
|
||||
} do={
|
||||
$LogPrint error $0 ("Reloading global configuration and functions failed! " . $Err);
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Reloading global functions failed!");
|
||||
}
|
||||
}
|
||||
|
||||
:if ($ReloadGlobalConfig = true) do={
|
||||
$LogPrint info $0 ("Reloading global configuration.");
|
||||
:do {
|
||||
/system/script/run global-config;
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Reloading global configuration failed!" . \
|
||||
" Syntax error or missing overlay?");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue