Line 0
Link Here
|
|
|
1 |
[Finding orphan files] |
2 |
.PP |
3 |
\fBqfile\fP can also, with the \fB\-\-orphans\fP option, find files which are |
4 |
not owned by any package. This behavior is the opposite of the usual file |
5 |
owner search: the output is the list of query items for which no reference has |
6 |
been found in your installed packages database. The \fB\-\-exact\fP option has |
7 |
no effect in this mode, whereas \fB\-\-verbose\fP may add a few warning |
8 |
messages. As for \fB\-\-quiet\fP, it will completly turn off the output, |
9 |
leaving just a silent test command, which returns \fI0\fP if and only if |
10 |
there was no orphan in your query items. |
11 |
.PP |
12 |
Find the orphan libtool files of your system: |
13 |
.nf\fI |
14 |
$ qfile -o $(find /lib /usr/lib -name "*.la") |
15 |
/usr/lib/libGL.la |
16 |
.fi |
17 |
.PP |
18 |
Find the libraries needed by the binary "foo" which have not been installed by |
19 |
any package: |
20 |
.nf\fI |
21 |
$ qfile -o $(scanelf -nq -F%n#F /path/to/foo | tr , '\\n') |
22 |
libinstalledmanually.so.2 |
23 |
.fi |
24 |
.PP |
25 |
Script to find the orphan config files on your system |
26 |
(\fBIMPORTANT:\fP this script is just a quick example. Do not blindly delete |
27 |
the files it will list!): |
28 |
.nf\fI |
29 |
#!/bin/bash |
30 |
SEARCH_PATHS="$(portageq envvar CONFIG_PROTECT)" |
31 |
SEARCH_MASK="$(portageq envvar CONFIG_PROTECT_MASK) \\ |
32 |
/etc/runlevels /etc/portage \\ |
33 |
/etc/ssl/certs /etc/ssh \\ |
34 |
/etc/bash_completion.d /etc/cups" |
35 |
for path in ${SEARCH_MASK} ; do |
36 |
EXCLUDE="${EXCLUDE} -not -path ${path}/*" |
37 |
done |
38 |
set -f |
39 |
find ${SEARCH_PATHS} ${EXCLUDE} -print0 \\ |
40 |
| xargs -0 -n 500 qfile -o |
41 |
.fi |