Replaced util-linux with ubase

This commit is contained in:
Alexander Hill
2026-02-08 07:10:59 -05:00
parent 4008f26846
commit 87d540f7d6
7 changed files with 47 additions and 59 deletions

14
scripts/pkgconflict.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: pkgconflict.sh <package directory>" >&2
exit 1
fi
BUFFER=$(mktemp)
for pkg in $1/*.cpio.xz; do
# NOTE: This only highlights the need for machine-readable filenames. ~ahill
NAME=$(basename $pkg | sed -E "s/-[0-9].+$//")
bsdcpio -iJt < $pkg | sed -E "/^\.(\/(bin|boot|etc|lib|usr|usr\/include|usr\/share|usr\/share\/man|usr\/share\/man\/man[1-8]))?$/d" | sed "s/$/:$NAME/" >> $BUFFER
done
# First time using Lua for something like this. Is there a better way to write this? ~ahill
sort -k1,1 -t: $BUFFER | lua -e "l, s = nil, {} for p, n in io.read(\"*all\"):gmatch(\"([^:]+):(%S+)\") do if p == l then table.insert(s, n) else if #s > 1 then io.write(l .. \":\" .. table.concat(s, \",\")) end l, s = p, {n} end end"
rm $BUFFER