docs
[mirrors/Programs.git] / pacman-doctor / pacman-orphans.sh
... / ...
CommitLineData
1#!/bin/bash
2db="$(mktemp)"
3fs="$(mktemp)"
4orphans="$(mktemp)"
5
6echo "[*] Saving list of files owned by pacman to $db ..." >&2
7time /usr/bin/pacman -Qlq | sort -u > "$db"
8echo >&2
9echo "[*] Saving list of files in filesystem to $fs ..." >&2
10time 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;
14done | sort -u > "$fs"
15echo >&2
16echo "[*] Comparing db ( $db ) and fs ( $fs ) ..." >&2
17time comm -23 "$fs" "$db" | tee "$orphans"
18rm -- "$db" "$fs"
19echo >&2
20echo "[!] 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.145273 seconds and 4 git commands to generate.