create temporary apt.conf inside chroot because unshared process might not have permissions to write into TMPDIR
This commit is contained in:
parent
9918809a65
commit
3e50d09b43
1 changed files with 7 additions and 1 deletions
|
@ -1185,7 +1185,12 @@ sub setup {
|
||||||
warning "cannot read $options->{apttrustedparts}";
|
warning "cannot read $options->{apttrustedparts}";
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($conf, $tmpfile) = tempfile(UNLINK => 1)
|
# We create the temporary apt.conf inside the rootfs as an easy way to make
|
||||||
|
# sure that the unshared process is able to create it even if the user has
|
||||||
|
# TMPDIR set to a directory that the unshared process does not directly
|
||||||
|
# have access to.
|
||||||
|
my ($conf, $tmpfile)
|
||||||
|
= tempfile("mmdebstrap.apt.conf.XXXXXXXXXXXX", DIR => $options->{root})
|
||||||
or error "cannot open apt.conf: $!";
|
or error "cannot open apt.conf: $!";
|
||||||
print $conf "Apt::Architecture \"$options->{nativearch}\";\n";
|
print $conf "Apt::Architecture \"$options->{nativearch}\";\n";
|
||||||
# the host system might have configured additional architectures
|
# the host system might have configured additional architectures
|
||||||
|
@ -2331,6 +2336,7 @@ sub setup {
|
||||||
});
|
});
|
||||||
run_apt_progress(
|
run_apt_progress(
|
||||||
{ ARGV => ['apt-get', 'clean'], CHDIR => $options->{root} });
|
{ ARGV => ['apt-get', 'clean'], CHDIR => $options->{root} });
|
||||||
|
unlink $tmpfile or error "failed to unlink $tmpfile: $!";
|
||||||
|
|
||||||
# apt since 1.6 creates the auxfiles directory. If apt inside the chroot
|
# apt since 1.6 creates the auxfiles directory. If apt inside the chroot
|
||||||
# is older than that, then it will not know how to clean it.
|
# is older than that, then it will not know how to clean it.
|
||||||
|
|
Loading…
Reference in a new issue