-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisowned
executable file
·40 lines (32 loc) · 1.07 KB
/
disowned
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env sh
# compat: +ash +bash +dash +zsh
disowned() { ### @- find files in system directories that aren't associated with any pacman packages.
#
# Lists Pacman disowned files.
#
# Authors:
# Benjamin Boudreau <[email protected]>
# Sorin Ionescu <[email protected]>
#
TMPDIR=/tmp
local tmp="$TMPDIR/pacman-disowned-$UID-$$"
mkdir -p "$tmp"
#trap 'rm -rf "$tmp"' EXIT # dangerous, needs fixing
pacman --quiet --query --list | sort -u > "$tmp/db"
if [ -n "$MSYSTEM" ]; then
# this excludes /bin due to confusion over symlinks.
# /lib and /sbin don't exist.
set -- /clang32 /clang64 /clangarm64 /etc /mingw32 /mingw64 /ucrt64 /usr
else
set -- /bin /etc /lib /sbin /usr
fi
find "$@" ! -name lost+found \
\( -type d -printf '%p/\n' -o -print \) \
| grep -v '^/etc/pacman.d/gnupg/' \
| grep -v '^/usr/busybox/' \
| grep -v '/__pycache__/' \
| sort -u \
> "$tmp/fs"
comm -23 "$tmp/fs" "$tmp/db"
}
[ -n "${preload+-}" ] || disowned "$@"