Some improvements in pacorphans.sh
[mirrors/Programs.git] / bash / pacman-repairs / pacorphans.sh
1 #!/bin/bash
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
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;
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
21
22 #test it:
23 #cat "$orphans" | while read i; do pacman -Qo "$i" 2>&1; done | tee /tmp/orphantest.txt
This page took 0.358098 seconds and 4 git commands to generate.