kiss-orphans: Performance fixes. More to come

This commit is contained in:
Dylan Araps 2020-09-24 09:16:31 +03:00
parent 7bc3a0eb92
commit 466706f7c5
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 10 additions and 12 deletions

View File

@ -1,17 +1,15 @@
#!/bin/sh -e
# List orphaned packages
cd "$KISS_ROOT/var/db/kiss/installed/"
set -- *
cd "$KISS_ROOT/var/db/kiss/installed"
for pkg in *; do
case $pkg in
# Exemptions for orphans which aren't really
# orphans. Exclude them from the list.
baseinit|baselayout|gcc|e2fsprogs|musl|\
make|busybox|bzip2|grub|kiss|git)
continue
esac
# List of installed packages.
printf -- '%s\n' * > "${TMPDIR:-/tmp}/packages"
grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg"
done
# List of runtime dependencies.
grep -hv ' make\|^#' ./*/depends | sort -u |
# Remove items in list 2 from list 1.
comm -23 "${TMPDIR:-/tmp}/packages" -
rm -f "${TMPDIR:-/tmp}/packages"