diff options
author | Christian Hesse <mail@eworm.de> | 2020-07-16 21:06:13 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-07-16 21:06:13 +0200 |
commit | 4c61cd0b650d6bab1aafb32f1d1100fa4bb2f7fe (patch) | |
tree | c596456a21f0c833be2e9efe9c0390c9ad187755 /global-functions | |
parent | 910641b6fa9548e0b06f64aad82082506b03c89e (diff) |
global-functions: $DeviceInfo: use $IfThenElse
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/global-functions b/global-functions index e20017b..17796fa 100644 --- a/global-functions +++ b/global-functions @@ -186,41 +186,31 @@ :global GlobalConfigVersion; :global Identity; + :global IfThenElse; + :local Resource [ / system resource get ]; :local RouterBoard [ / system routerboard get ]; :local Update [ / system package update get ]; - :local Info ( \ - "Hostname: " . $Identity . "\n" . \ - "Board name: " . $Resource->"board-name" . "\n" . \ - "Architecture: " . $Resource->"architecture-name"); - :if ($RouterBoard->"routerboard" = true) do={ - :local Revision ""; - :if ([ :len ($RouterBoard->"revision") ] > 0) do={ - :set Revision (" " . $RouterBoard->"revision"); - } - :set Info ($Info . "\n" . \ - "Model: " . $RouterBoard->"model" . $Revision . "\n" . \ - "Serial number: " . $RouterBoard->"serial-number"); - } - :set Info ($Info . "\n" . \ - "RouterOS:\n" . \ - " Channel: " . $Update->"channel" . "\n" . \ - " Installed: " . $Update->"installed-version"); - :if ([ :typeof ($Update->"latest-version") ] != "nothing" && \ - $Update->"installed-version" != $Update->"latest-version") do={ - :set Info ($Info . "\n" . \ - " Available: " . $Update->"latest-version"); - } - :set Info ($Info . "\n" . \ - "RouterOS-Scripts Configuration Version:\n" . \ - " Current: " . $GlobalConfigVersion); - :if ($GlobalConfigVersion != $ExpectedConfigVersion) do={ - :set Info ($Info . "\n" . \ - " Expected: " . $ExpectedConfigVersion); - } - - :return $Info; + :return ( \ + "Hostname: " . $Identity . \ + "\nBoard name: " . $Resource->"board-name" . \ + "\nArchitecture: " . $Resource->"architecture-name" . \ + [ $IfThenElse ($RouterBoard->"routerboard" = true) \ + ("\nModel: " . $RouterBoard->"model" . \ + [ $IfThenElse ([ :len ($RouterBoard->"revision") ] > 0) \ + (" " . $RouterBoard->"revision") ] . \ + "\nSerial number: " . $RouterBoard->"serial-number") ] . \ + "\nRouterOS:" . \ + "\n Channel: " . $Update->"channel" . \ + "\n Installed: " . $Update->"installed-version" . \ + [ $IfThenElse ([ :typeof ($Update->"latest-version") ] != "nothing" && \ + $Update->"installed-version" != $Update->"latest-version") \ + ("\n Available: " . $Update->"latest-version") ] . \ + "\nRouterOS-Scripts Configuration Version:" . \ + "\n Current: " . $GlobalConfigVersion . \ + [ $IfThenElse ($GlobalConfigVersion != $ExpectedConfigVersion) \ + ("\n Expected: " . $ExpectedConfigVersion) ]); } # check if DNS is resolving |