mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-06-20 21:35:43 +02:00
Add a new script to parse RouterOS version
This commit is contained in:
parent
3262a68a25
commit
2f5006bd3b
1 changed files with 32 additions and 0 deletions
32
scripts/parse-version.rsc
Normal file
32
scripts/parse-version.rsc
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Inspired by https://forum.mikrotik.com/viewtopic.php?t=40507#p841720
|
||||
|
||||
# :local full "7.0.1"
|
||||
:local full [/system/routerboard/get current-firmware]
|
||||
|
||||
:local length [:len $full]
|
||||
:local major
|
||||
:local minor
|
||||
:local patch
|
||||
|
||||
:put "Full version: $full"
|
||||
|
||||
:local pos [:find $full "."]
|
||||
|
||||
:set major [:pick $full 0 $pos]
|
||||
|
||||
:put "Major: $major"
|
||||
|
||||
:local minorPatch [:pick $full ($pos +1) $length]
|
||||
|
||||
# :put $minorPatch
|
||||
|
||||
:local pos [:find $minorPatch "."]
|
||||
|
||||
:set minor [:pick $minorPatch 0 $pos]
|
||||
|
||||
:put "Minor: $minor"
|
||||
|
||||
:set length [:len $minorPatch]
|
||||
:set patch [:pick $minorPatch ($pos +1) $length]
|
||||
|
||||
:put "Patch: $patch"
|
Loading…
Add table
Add a link
Reference in a new issue