fix some multi-package repo bugs

This commit is contained in:
2026-09-16 09:06:20 -04:00
parent 5623db1090
commit b009575ddd
+3 -4
View File
@@ -20,12 +20,11 @@ echo
# Get unique package names (strip version info) # Get unique package names (strip version info)
for pkg in $(find "$binpkgs_dir" -maxdepth 1 -name '*.xbps' -type f -printf '%f\n' | sed 's/-[0-9].*//' | sort -u); do for pkg in $(find "$binpkgs_dir" -maxdepth 1 -name '*.xbps' -type f -printf '%f\n' | sed 's/-[0-9].*//' | sort -u); do
# Find all versions of this package, sorted by modification time (newest first) # Find all versions of this package, sorted by version (newest first)
# Keep only the first (newest), remove the rest # Keep only the first (newest), remove the rest
find "$binpkgs_dir" -maxdepth 1 -name "${pkg}-*.xbps" -type f -printf '%T@ %p\n' | \ find "$binpkgs_dir" -maxdepth 1 -name "${pkg}-[0-9]*.xbps" -type f -printf '%p\n' | \
sort -rn | \ sort -rV | \
tail -n +2 | \ tail -n +2 | \
cut -d' ' -f2- | \
while read -r old_pkg; do while read -r old_pkg; do
echo "Removing: $(basename "$old_pkg")" echo "Removing: $(basename "$old_pkg")"
rm -f "$old_pkg" rm -f "$old_pkg"