diff options
author | Christian Hesse <mail@eworm.de> | 2019-02-21 18:03:51 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-02-21 18:08:29 +0100 |
commit | 4c28e9f9c2c2eea1c3f8a45fd694d62a3e0d3e75 (patch) | |
tree | ea636d13eb95a180107384ebbdb82be96b46019c /check-routeros-update | |
parent | 04025da9b82260544c60019394fb88428fb215ce (diff) |
check-routeros-update: allow interactive update from terminal
Diffstat (limited to 'check-routeros-update')
-rw-r--r-- | check-routeros-update | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/check-routeros-update b/check-routeros-update index 2a482bd..95507c7 100644 --- a/check-routeros-update +++ b/check-routeros-update @@ -10,6 +10,15 @@ :global SendNotification; +:local Update do={ + :if ([ / system script print count-only where name="packages-update" ] > 0) do={ + / system script run packages-update; + } else={ + / system package update install without-paging; + } + :error "Waiting for system to reboot."; +} + :if ([ / system package print count-only where name="wireless" disabled=no ] > 0) do={ :if ([ / interface wireless cap get enabled ] = true && \ [ / caps-man manager get enabled ] = false) do={ @@ -41,12 +50,16 @@ $SendNotification ("RouterOS update notification") \ ("Version " . $LatestVersion . " is considered safe for " . $Channel . \ ", updating on " . $Identity . "..."); - :if ([ / system script print count-only where name="packages-update" ] > 0) do={ - / system script run packages-update; - } else={ - / system package update install without-paging; - } - :error "Waiting for system to reboot."; + $Update; + } + } + + :if ([ / system script job print count-only where script="check-routeros-update" parent~"." ] > 0) do={ + :put ("Do you want to install RouterOS version " . $LatestVersion . "? (y/n)"); + :if ([ :terminal inkey timeout=60 ] = 121) do={ + $Update; + } else={ + :put "Canceled..."; } } |