# dpkg manual page - dpkg-realpath(1)
#
# Copyright © 2020-2021 Guillem Jover <guillem@debian.org>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

=encoding utf8

=head1 NAME

dpkg-realpath - print the resolved pathname with DPKG_ROOT support

=head1 SYNOPSIS

B<dpkg-realpath> [I<option>...] I<pathname>

=head1 DESCRIPTION

B<dpkg-realpath> is a tool (since dpkg 1.20.1) to resolve a pathname,
that takes the L<dpkg(1)> root directory into account, either implicitly
from the B<DPKG_ROOT> environment variable or from the command-line
B<--root> or B<--instdir> options, and returns an absolute I<pathname>
relative to the root directory.
The root directory must not be prefixed to the I<pathname> to be resolved.

This is intended to be used by other B<dpkg> helpers, or by maintainer
scripts instead of using L<realpath(1)> or L<readlink(1)> to canonicalize
pathnames, as these latter commands do not support canonicalization
relative to a different root than F</>.

=head1 OPTIONS

=over

=item B<-z>, B<--zero>

Use a NUL byte to end output lines instead of a new line character
(since dpkg 1.20.6).

=item B<--instdir> I<directory>

=item B<--root> I<directory>

Set the root directory to I<directory>, which is the base directory
that pathnames get canonicalized against.
Defaults to «B</>».

=item B<-?>, B<--help>

Show the usage message and exit.

=item B<--version>

Show the version and exit.

=back

=head1 ENVIRONMENT

=over

=item B<DPKG_ROOT>

If set and the B<--instdir> or B<--root> options have not been
specified, it will be used as the filesystem root directory.

=item B<DPKG_COLORS>

Sets the color mode.
The currently accepted values are: B<auto> (default), B<always> and B<never>.

=back

=head1 SEE ALSO

L<realpath(1)>,
L<readlink(1)>.
