aboutsummaryrefslogtreecommitdiffstats
path: root/script-updates
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-07-05 15:29:26 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-07-05 15:34:08 +0200
commite1f134ead584c7b2e9ed406f5520d7f1a23294aa (patch)
tree929660280fb0acc183401d7e59a40f1cd7e8992c /script-updates
parent1d99dc38ff1f583d6e46adc5d1ba3455114d53c1 (diff)
add scripts
Diffstat (limited to 'script-updates')
-rw-r--r--script-updates17
1 files changed, 17 insertions, 0 deletions
diff --git a/script-updates b/script-updates
new file mode 100644
index 0000000..13480d1
--- /dev/null
+++ b/script-updates
@@ -0,0 +1,17 @@
+# RouterOS script: script-updates
+# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
+#
+# update installed scripts from file
+
+:foreach script in=[ / system script find ] do={
+ :local scriptname [ / system script get $script name ];
+ :local scriptfile [ / file find where name=("script-updates/" . $scriptname) ];
+ :if ([ :len $scriptfile ] > 0) do={
+ :log info ("Updating script: " . $scriptname);
+ :local scriptcontent [ / file get $scriptfile content ];
+ / system script set owner=$scriptname source=$scriptcontent $script;
+ / file remove $scriptfile;
+ } else={
+ :log debug ("No update for script " . $scriptname);
+ }
+}