Some improvements in pacorphans.sh
authorHarvie <tomas@mudrunka.cz>
Fri, 4 Jun 2010 13:21:02 +0000 (15:21 +0200)
committerHarvie <tomas@mudrunka.cz>
Fri, 4 Jun 2010 13:21:02 +0000 (15:21 +0200)
bash/pacorphans.sh

index 1db738263d5f782f9313522a69bda436902b51d8..a50669790d9b38ed96f59eda6b3701146ced4f37 100755 (executable)
@@ -1,11 +1,23 @@
 #!/bin/bash
-time /usr/bin/pacman -Ql | cut -d ' ' -f 2- | sort -u > db.txt
+db="$(mktemp)"
+fs="$(mktemp)"
+orphans="$(mktemp)"
+
+echo "[*] Saving list of files owned by pacman to $db ..." >&2
+time /usr/bin/pacman -Qlq | sort -u > "$db"
+echo >&2
+echo "[*] Saving list of files in filesystem to $fs ..." >&2
 time find /arch /bin /boot /etc /lib /opt /sbin /usr 2>/dev/null | while read i; do
        if [ ! -d "$i" ]; then
                echo "$i"
        fi;
-done | sort -u > fs.txt
-time comm -23 fs.txt db.txt > non-db.txt
+done | sort -u > "$fs"
+echo >&2
+echo "[*] Comparing db ( $db ) and fs ( $fs ) ..." >&2
+time comm -23 "$fs" "$db" | tee "$orphans"
+rm -- "$db" "$fs"
+echo >&2
+echo "[!] List of files not owned by any package were saved to: $orphans" >&2
 
 #test it:
-#cat non-db.txt | while read i; do pacman -Qo "$i" 2>&1; done | tee test.txt
+#cat "$orphans" | while read i; do pacman -Qo "$i" 2>&1; done | tee /tmp/orphantest.txt
This page took 0.141616 seconds and 4 git commands to generate.