export MMDEBSTRAP_ARGV0 for hooks

This commit is contained in:
Johannes Schauer Marin Rodrigues 2023-03-19 08:58:53 +01:00
parent 846662276f
commit 4d44b9dbbe
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1613,6 +1613,9 @@ sub run_hooks {
if (length $ENV{APT_CONFIG}) { if (length $ENV{APT_CONFIG}) {
push @env_opts, "MMDEBSTRAP_APT_CONFIG=$ENV{APT_CONFIG}"; push @env_opts, "MMDEBSTRAP_APT_CONFIG=$ENV{APT_CONFIG}";
} }
# I hook script that wants to call mmdebstrap with --hook-helper needs to
# know how mmdebstrap was executed
push @env_opts, "MMDEBSTRAP_ARGV0=$PROGRAM_NAME";
# Storing the mode is important for hook scripts to potentially change # Storing the mode is important for hook scripts to potentially change
# their behavior depending on the mode. It's also important for when the # their behavior depending on the mode. It's also important for when the
# hook wants to use the mmdebstrap --hook-helper. # hook wants to use the mmdebstrap --hook-helper.
@ -6942,11 +6945,13 @@ C<MMDEBSTRAP_APT_CONFIG> environment variable. All environment variables set by
the user are preserved, except for C<TMPDIR> which is cleared. See section the user are preserved, except for C<TMPDIR> which is cleared. See section
B<TMPDIR>. Furthermore, C<MMDEBSTRAP_MODE> will store the mode set by B<TMPDIR>. Furthermore, C<MMDEBSTRAP_MODE> will store the mode set by
B<--mode>, C<MMDEBSTRAP_HOOK> stores which hook is currently run (setup, B<--mode>, C<MMDEBSTRAP_HOOK> stores which hook is currently run (setup,
extract, essential, customize) and C<MMDEBSTRAP_VERBOSITY> stores the numerical extract, essential, customize), C<MMDEBSTRAP_ARGV0> stores the name of the
verbosity level (0 for no output, 1 for normal, 2 for verbose and 3 for debug binary with which B<mmdebstrap> was executed and C<MMDEBSTRAP_VERBOSITY> stores
output). The C<MMDEBSTRAP_INCLUDE> variable stores the list of packages, apt the numerical verbosity level (0 for no output, 1 for normal, 2 for verbose and
patterns or file paths given by the B<--include> option, separated by a comma 3 for debug output). The C<MMDEBSTRAP_INCLUDE> variable stores the list of
and with commas and percent signs in the option values urlencoded. packages, apt patterns or file paths given by the B<--include> option,
separated by a comma and with commas and percent signs in the option values
urlencoded.
In special hooks, the paths inside the chroot are relative to the root In special hooks, the paths inside the chroot are relative to the root
directory of the chroot. The path on the outside is relative to current directory of the chroot. The path on the outside is relative to current