#!/bin/sh # Scan the filesystem for orphaned/unused files (super slow because portage-utils doesn't accept stdin) # Note that this files a *lot* of pre/postinstall files that should(!) exist tmp1="$(mktemp)" tmp2="$(mktemp)" trap "rm -f '$tmp1' '$tmp2'" EXIT cat orphans_ignore.txt orphans_ignore/*.txt | grep '^/' | sort > "$tmp1" find /bin /sbin /lib /lib64 /usr > "$tmp2" grep -xvf "$tmp1" "$tmp2" | xargs -P$(nproc) -d '\n' qfile -o | tee orphans.txt grep -Fxvf "$tmp2" "$tmp1" | grep -v '\*' | tee orphans_missing.txt #find /etc | \ #grep -xvf "$tmp" | \ #xargs -P$(nproc) -d '\n' qfile -o | tee orphans.txt