aboutsummaryrefslogtreecommitdiff
blob: 3bfbe51e7cd68f60fe18a1650c63fcad23c77579 (plain)
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
.SH "$ROOT HANDLING"
.PP
By setting the \fIROOT\fP environment variable, you can force \fBqfile\fP to
work in the sytem of your choice. This example shows queries for owner of
"/bin/sh", first on your main system, and then on a system mounted on "/mnt":
.nf\fI
	$ qfile -q /bin/sh
	app-shells/bash
	$ ROOT=/mnt qfile -q /bin/sh
	sys-apps/busybox
.fi
.PP
Note that the query item is "/bin/sh" in both commands: by default, what
\fBqfile\fP looks for is file paths as they are recorded in the packages
database of the target system, and this paths don't include \fI$ROOT\fP.
If, on the contrary, you want to query files with their current actual
paths (including the mount point), you should add the \fB\-\-root\-prefix\fP
(\fB\-R\fP) option:
.nf\fI
	$ ROOT=/mnt qfile -Rq /mnt/bin/sh
	sys-apps/busybox
.fi
.PP
The other difference between defaults and \fB\-R\fP queries is the output
of files paths.  The former doesn't include the \fI$ROOT\fP prefix, and the
latter does:
.nf\fI
	$ ROOT=/mnt qfile sh
	sys-apps/busybox: /bin/sh
	$ ROOT=/mnt qfile -R sh
	sys-apps/busybox: /mnt/bin/sh
.fi
.PP
Sure, the same differences hold when querying for orphan files:
.nf\fI
	$ ROOT=/mnt qfile -o $(ls /mnt/bin/ | sed 's:^/mnt::')
	/bin/dostuff.sh
	$ ROOT=/mnt qfile -Ro /mnt/bin/*
	/mnt/bin/dostuff.sh
.fi