mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-21 11:24:31 +02:00
remove-packages: remove outdated packages only
This commit is contained in:
parent
d68a1def31
commit
a1951cc86a
1 changed files with 12 additions and 2 deletions
|
@ -2,6 +2,16 @@
|
||||||
# RouterOS script: remove-packages
|
# RouterOS script: remove-packages
|
||||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||||
#
|
#
|
||||||
# remove packages (*.npk) from storage
|
# remove packages (*.npk) not matching installed version
|
||||||
|
|
||||||
/ file remove [ / file find type="package" ];
|
:local version [ / system package update get installed-version ];
|
||||||
|
|
||||||
|
:foreach package in=[ / file find type="package" ] do={
|
||||||
|
:local filename [ / file get $package name ];
|
||||||
|
:if ($filename~$version) do={
|
||||||
|
:log debug ("Package file " . $filename . " is up-to-date.");
|
||||||
|
} else={
|
||||||
|
:log debug ("Removing old packge file: " . $filename);
|
||||||
|
/ file remove $package;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue