docs
[mirrors/Programs.git] / bash / pacman-doctor / pacman-orphans.sh
CommitLineData
8d2f5c9a 1#!/bin/bash
f00faa05
H
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
8d2f5c9a
H
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;
f00faa05
H
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
8d2f5c9a
H
21
22#test it:
f00faa05 23#cat "$orphans" | while read i; do pacman -Qo "$i" 2>&1; done | tee /tmp/orphantest.txt
This page took 0.163405 seconds and 4 git commands to generate.