1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

capsman-download-packages: switch to $LogPrint

This commit is contained in:
Christian Hesse
2024-03-08 12:45:37 +01:00
parent ca822e1358
commit e40da1e7e4
3 changed files with 27 additions and 21 deletions

View File

@ -19,7 +19,7 @@
:global CleanFilePath; :global CleanFilePath;
:global DownloadPackage; :global DownloadPackage;
:global LogPrintExit2; :global LogPrint;
:global MkDir; :global MkDir;
:global ScriptLock; :global ScriptLock;
:global WaitFullyConnected; :global WaitFullyConnected;
@ -34,16 +34,18 @@
:local Updated false; :local Updated false;
:if ([ :len $PackagePath ] = 0) do={ :if ([ :len $PackagePath ] = 0) do={
$LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true; $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:error false;
} }
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={ :if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={ :if ([ $MkDir $PackagePath ] = false) do={
$LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!") true; $PackagePath . ") failed!");
:error false;
} }
$LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!") false; "). Please place your packages!");
} }
:foreach Package in=[ /file/find where type=package \ :foreach Package in=[ /file/find where type=package \
@ -60,7 +62,7 @@
} }
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={ :if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false; $LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "mipsbe" } do={ :foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={ :foreach Package in={ "routeros"; "wireless" } do={
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={ :if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={

View File

@ -20,7 +20,7 @@
:global CleanFilePath; :global CleanFilePath;
:global DownloadPackage; :global DownloadPackage;
:global LogPrintExit2; :global LogPrint;
:global MkDir; :global MkDir;
:global ScriptLock; :global ScriptLock;
:global WaitFullyConnected; :global WaitFullyConnected;
@ -36,16 +36,18 @@
:local Updated false; :local Updated false;
:if ([ :len $PackagePath ] = 0) do={ :if ([ :len $PackagePath ] = 0) do={
$LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true; $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:error false;
} }
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={ :if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={ :if ([ $MkDir $PackagePath ] = false) do={
$LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!") true; $PackagePath . ") failed!");
:error false;
} }
$LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!") false; "). Please place your packages!");
} }
:foreach Package in=[ /file/find where type=package \ :foreach Package in=[ /file/find where type=package \
@ -62,7 +64,7 @@
} }
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={ :if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false; $LogPrint info $ScriptName ("No packages available, downloading default set.");
# NOT /interface/wifi/ # # NOT /interface/wifi/ #
:foreach Arch in={ "arm"; "mipsbe" } do={ :foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={ :foreach Package in={ "routeros"; "wireless" } do={

View File

@ -19,7 +19,7 @@
:global CleanFilePath; :global CleanFilePath;
:global DownloadPackage; :global DownloadPackage;
:global LogPrintExit2; :global LogPrint;
:global MkDir; :global MkDir;
:global ScriptLock; :global ScriptLock;
:global WaitFullyConnected; :global WaitFullyConnected;
@ -34,16 +34,18 @@
:local Updated false; :local Updated false;
:if ([ :len $PackagePath ] = 0) do={ :if ([ :len $PackagePath ] = 0) do={
$LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true; $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:error false;
} }
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={ :if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={ :if ([ $MkDir $PackagePath ] = false) do={
$LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!") true; $PackagePath . ") failed!");
:error false;
} }
$LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!") false; "). Please place your packages!");
} }
:foreach Package in=[ /file/find where type=package \ :foreach Package in=[ /file/find where type=package \
@ -60,7 +62,7 @@
} }
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={ :if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false; $LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "arm64" } do={ :foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" }; :local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
"arm64"={ "routeros"; "wifi-qcom" } }; "arm64"={ "routeros"; "wifi-qcom" } };