Skip to content

Instantly share code, notes, and snippets.

@sebastian13
Last active August 4, 2022 10:12
Show Gist options
  • Save sebastian13/c1493a12d57e2f871cb1224a5efb3c07 to your computer and use it in GitHub Desktop.
Save sebastian13/c1493a12d57e2f871cb1224a5efb3c07 to your computer and use it in GitHub Desktop.

Download RouterOS packages for CAPs on CAPsMAN

  1. Create the script download-caps-routeros. Add or remove packages, depeding on caps' hardware.

  2. Add a scheduler

/system scheduler
add name=download-caps-routeros on-event=":delay 120s\
    \n/system script run download-caps-routeros" start-time=startup
  1. Set the Package-Path
/caps-man manager
set package-path=/capsman-routeros upgrade-policy=suggest-same-version
  1. Add the upgrade-firmware script to the cap. Set startup scheduler.
:put "Cleanup old downloads"
/file remove numbers=[ find where name="capsman-routeros" ]
:local installed [/system package get routeros version]
:put "Running RouterOS $installed. Will download CAPs RouterOS packages."
# URL only valid for RouterOS v7
/tool fetch mode=https url="https://download.mikrotik.com/routeros/$installed/routeros-$installed-mipsbe.npk" dst-path="capsman-routeros/routeros-$installed-mipsbe.npk"
/tool fetch mode=https url="https://download.mikrotik.com/routeros/$installed/routeros-$installed-arm.npk" dst-path="capsman-routeros/routeros-$installed-arm.npk"
# Initiate Upgrade
:local caps [/caps-man remote-cap find where version!="$installed"]
:foreach i in=$caps do={
:put "Initiate Upgrade on $i"
/caps-man remote-cap upgrade numbers=$i
:delay 60s
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment