capsman-download-packages: adopt new functionality from file menu

This commit is contained in:
Christian Hesse 2025-05-30 23:22:59 +02:00
parent 733e2f695e
commit d3c802c791
4 changed files with 22 additions and 16 deletions

View file

@ -4,7 +4,7 @@
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires RouterOS, version=7.18
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
@ -42,7 +42,9 @@
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:do {
/file/get $PackagePath;
} on-error={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
@ -53,8 +55,8 @@
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:foreach Package in=[ /file/find recursive where path=$PackagePath \
type="package" package-version!=$InstalledVersion ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
@ -66,7 +68,7 @@
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={

View file

@ -4,7 +4,7 @@
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires RouterOS, version=7.18
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
@ -44,7 +44,9 @@
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:do {
/file/get $PackagePath;
} on-error={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
@ -55,8 +57,8 @@
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:foreach Package in=[ /file/find recursive where path=$PackagePath \
type="package" package-version!=$InstalledVersion ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
@ -68,7 +70,7 @@
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
# NOT /interface/wifi/ #
:foreach Arch in={ "arm"; "mipsbe" } do={

View file

@ -4,7 +4,7 @@
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires RouterOS, version=7.18
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
@ -42,7 +42,9 @@
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:do {
/file/get $PackagePath;
} on-error={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
@ -53,8 +55,8 @@
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:foreach Package in=[ /file/find recursive where path=$PackagePath \
type="package" package-version!=$InstalledVersion ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
@ -66,7 +68,7 @@
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
:if ([ :len [ /file/find recursive where path=$PackagePath type="package" ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };

View file

@ -4,7 +4,7 @@ Download packages for CAP upgrade from CAPsMAN
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.18-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)