diff options
author | Christian Hesse <mail@eworm.de> | 2022-05-12 11:04:43 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-05-12 11:04:43 +0200 |
commit | df547b87a47e279d3f6b744675821621eea5d7b8 (patch) | |
tree | d5b33fb62e10637d70d8d0616437294ceb15ed9f /check-routeros-update | |
parent | 93ec9afe558ef6eba5d513fab359bb5f6618666d (diff) | |
parent | 12655bd58afc3a75fe3e2958bbe130b96f8b9be7 (diff) |
Merge branch 'ros-v7-path-syntax' into next
Diffstat (limited to 'check-routeros-update')
-rw-r--r-- | check-routeros-update | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/check-routeros-update b/check-routeros-update index 8cad07a..3d4f14a 100644 --- a/check-routeros-update +++ b/check-routeros-update @@ -27,10 +27,10 @@ :global WaitFullyConnected; :local DoUpdate do={ - :if ([ :len [ / system script find where name="packages-update" ] ] > 0) do={ - / system script run packages-update; + :if ([ :len [ /system/script/find where name="packages-update" ] ] > 0) do={ + /system/script/run packages-update; } else={ - / system package update install without-paging; + /system/package/update/install without-paging; } :error "Waiting for system to reboot."; } @@ -39,21 +39,21 @@ $ScriptLock $0; $WaitFullyConnected; -:if ([ :len [ / system package find where name="wireless" disabled=no ] ] > 0) do={ - :if ([ / interface wireless cap get enabled ] = true && \ - [ / caps-man manager get enabled ] = false && \ +:if ([ :len [ /system/package/find where name="wireless" disabled=no ] ] > 0) do={ + :if ([ /interface/wireless/cap/get enabled ] = true && \ + [ /caps-man/manager/get enabled ] = false && \ $SafeUpdateOnCap != true) do={ $LogPrintExit2 error $0 ("System is managed by CAPsMAN, not checking for RouterOS version.") true; } } -:if ([ :len [ / system scheduler find where name="reboot-for-update" ] ] > 0) do={ +:if ([ :len [ /system/scheduler/find where name="reboot-for-update" ] ] > 0) do={ :error "A reboot for update is already scheduled."; } $LogPrintExit2 debug $0 ("Checking for updates...") false; -/ system package update check-for-updates without-paging as-value; -:local Update [ / system package update get ]; +/system/package/update/check-for-updates without-paging as-value; +:local Update [ /system/package/update/get ]; :if ([ :len ($Update->"latest-version") ] = 0) do={ $LogPrintExit2 info $0 ("An empty string is not a valid version.") true; @@ -77,7 +77,7 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false; $DoUpdate; } - :if ($SafeUpdateNeighbor = true && [ :len [ / ip neighbor find where \ + :if ($SafeUpdateNeighbor = true && [ :len [ /ip/neighbor/find where \ version=($Update->"latest-version" . " (" . $Update->"channel" . ")") ] ] > 0) do={ $LogPrintExit2 info $0 ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false; $SendNotification2 ({ origin=$0; \ @@ -90,7 +90,7 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false; :if ([ :len $SafeUpdateUrl ] > 0) do={ :local Result; :do { - :set Result [ / tool fetch check-certificate=yes-without-crl \ + :set Result [ /tool/fetch check-certificate=yes-without-crl \ ($SafeUpdateUrl . $Update->"channel" . "?installed=" . $Update->"installed-version" . \ "&latest=" . $Update->"latest-version") output=user as-value ]; } on-error={ @@ -108,7 +108,7 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false; :if ([ $ScriptFromTerminal $0 ] = true) do={ :put ("Do you want to install RouterOS version " . $Update->"latest-version" . "? [y/N]"); - :if (([ / terminal inkey timeout=60 ] % 32) = 25) do={ + :if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={ $DoUpdate; } else={ :put "Canceled..."; |