aboutsummaryrefslogtreecommitdiffstats
path: root/capsman-rolling-upgrade
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-02-14 20:49:05 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-02-14 20:49:05 +0100
commit74683b3fc8571a684c6a781e2325253eed4736ae (patch)
treec8032b395e48fa72ef6cd9415e41e228b16aea40 /capsman-rolling-upgrade
parentf127e3b7efe4c7d5dcd828218bbd44cbe04dcb47 (diff)
capsman-download-packages: split off capsman-rolling-upgrade
Diffstat (limited to 'capsman-rolling-upgrade')
-rw-r--r--capsman-rolling-upgrade20
1 files changed, 20 insertions, 0 deletions
diff --git a/capsman-rolling-upgrade b/capsman-rolling-upgrade
new file mode 100644
index 0000000..431ac02
--- /dev/null
+++ b/capsman-rolling-upgrade
@@ -0,0 +1,20 @@
+#!rsc
+# RouterOS script: capsman-rolling-upgrade
+# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
+# Michael Gisbers <michael@gisbers.de>
+#
+# upgrade CAPs one after another
+
+:local InstalledVersion [ / system package update get installed-version ];
+
+:local RemoteCapCount [ /caps-man remote-cap print count-only ];
+:if ($RemoteCapCount > 0) do={
+ :local Delay (600 / $RemoteCapCount);
+ :if ($Delay > 120) do={ :set Delay 120; }
+ :foreach RemoteCap in=[ / caps-man remote-cap find where version!=$InstalledVersion ] do={
+ :local RemoteCapName [ / caps-man remote-cap get $RemoteCap name ];
+ :log debug ("Starting upgrade for CAP " . $RemoteCapName . "...");
+ / caps-man remote-cap upgrade $RemoteCap;
+ :delay ($Delay . "s");
+ }
+}