1DH_TESTROOT(1) Debhelper DH_TESTROOT(1)
2
3
4
6 dh_testroot - ensure that a package is built with necessary level of
7 root permissions
8
10 dh_testroot [debhelper options]
11
13 dh_testroot is used to determine if the target is being run with
14 suffient access to root(-like) features.
15
16 The definition of sufficient access depends on whether the builder (the
17 tool invoking the debian/rules target) supports the Rules-Requires-Root
18 (R³) field. If the builder supports R³, then it will set the
19 environment variable DEB_RULES_REQUIRES_ROOT and dh_testroot will
20 validate that the builder followed the minimum requirements for the
21 given value of DEB_RULES_REQUIRES_ROOT.
22
23 If the builder does not support Rules-Requires-Root, then it will not
24 set the DEB_RULES_REQUIRES_ROOT environment variable. This will in
25 turn make dh_testroot (and the rest of debhelper) fall back to assuming
26 that (fake)root is implied.
27
28 The following is a summary of how dh_testroot behaves based on the
29 DEB_RULES_REQUIRES_ROOT environment variable (leading and trailing
30 whitespace in the variable is ignored).
31
32 - If unset, or set to "binary-targets", then dh_testroot asserts that
33 it is run as root or under fakeroot(1).
34
35 - If set to "no", then dh_testroot returns successfully (without
36 performing any additional checks).
37
38 - If set to any other value than the above, then dh_testroot asserts
39 that it is either run as root (or under fakeroot(1)) or the builder
40 has provided the DEB_GAIN_ROOT_CMD environment variable (e.g. via
41 dpkg-buildpackage -r).
42
43 Please note that dh_testroot does not read the Rules-Requires-Root
44 field. Which implies that dh_testroot may produce incorrect result if
45 the builder lies in DEB_RULES_REQUIRES_ROOT. On the flip side, it also
46 enables things like testing for what will happen when
47 DEB_RULES_REQUIRES_ROOT is set to a given value.
48
50 debhelper(7)
51
52 This program is a part of debhelper.
53
55 Joey Hess <joeyh@debian.org>
56
57
58
5912.7.3 2020-07-27 DH_TESTROOT(1)