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 f54aa32aa9
commit 3313b86c6b
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
@ -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={