Commit | Line | Data |
---|---|---|
8d2f5c9a | 1 | #!/bin/bash |
f00faa05 H |
2 | db="$(mktemp)" |
3 | fs="$(mktemp)" | |
4 | orphans="$(mktemp)" | |
5 | ||
6 | echo "[*] Saving list of files owned by pacman to $db ..." >&2 | |
7 | time /usr/bin/pacman -Qlq | sort -u > "$db" | |
8 | echo >&2 | |
9 | echo "[*] Saving list of files in filesystem to $fs ..." >&2 | |
8d2f5c9a H |
10 | time find /arch /bin /boot /etc /lib /opt /sbin /usr 2>/dev/null | while read i; do |
11 | if [ ! -d "$i" ]; then | |
12 | echo "$i" | |
13 | fi; | |
f00faa05 H |
14 | done | sort -u > "$fs" |
15 | echo >&2 | |
16 | echo "[*] Comparing db ( $db ) and fs ( $fs ) ..." >&2 | |
17 | time comm -23 "$fs" "$db" | tee "$orphans" | |
18 | rm -- "$db" "$fs" | |
19 | echo >&2 | |
20 | echo "[!] List of files not owned by any package were saved to: $orphans" >&2 | |
8d2f5c9a H |
21 | |
22 | #test it: | |
f00faa05 | 23 | #cat "$orphans" | while read i; do pacman -Qo "$i" 2>&1; done | tee /tmp/orphantest.txt |