Compare commits
5 commits
b6a2a210a3
...
917a879c4b
Author | SHA1 | Date | |
---|---|---|---|
917a879c4b | |||
dc5bbb7173 | |||
e62f32b098 | |||
fcf1c407de | |||
1a17c70ffb |
4 changed files with 28 additions and 6 deletions
|
@ -435,3 +435,4 @@ Test: zombie-reaping
|
|||
Modes: unshare
|
||||
|
||||
Test: empty-suite
|
||||
Needs-APT-Config: true
|
||||
|
|
14
mmdebstrap
14
mmdebstrap
|
@ -3108,7 +3108,11 @@ sub run_setup() {
|
|||
# dpkg-preconfigure should not be needed as we also have set
|
||||
# DEBIAN_FRONTEND=noninteractive and DEBCONF_NONINTERACTIVE_SEEN=true and
|
||||
# should thus never see debconf prompts. See #1091442 for details.
|
||||
print $conf "#clear DPkg::Pre-Install-Pkgs;\n";
|
||||
{
|
||||
open my $tmp, '>', "$options->{root}/etc/apt/apt.conf.d/99debconf"
|
||||
or error "cannot open /etc/apt/apt.conf.d/99debconf: $!";
|
||||
print $tmp "#clear DPkg::Pre-Install-Pkgs;\n";
|
||||
}
|
||||
|
||||
close $conf;
|
||||
|
||||
|
@ -4164,6 +4168,8 @@ sub run_cleanup() {
|
|||
# clean up temporary configuration file
|
||||
unlink "$options->{root}/etc/apt/apt.conf.d/00mmdebstrap"
|
||||
or warning "failed to unlink /etc/apt/apt.conf.d/00mmdebstrap: $!";
|
||||
unlink "$options->{root}/etc/apt/apt.conf.d/99debconf"
|
||||
or warning "failed to unlink /etc/apt/apt.conf.d/99debconf: $!";
|
||||
|
||||
if (defined $ENV{APT_CONFIG} && -e $ENV{APT_CONFIG}) {
|
||||
unlink $ENV{APT_CONFIG}
|
||||
|
@ -6803,6 +6809,7 @@ sub main() {
|
|||
if (any { $_ eq $options->{format} }
|
||||
('tar', 'squashfs', 'ext2', 'ext4', 'null')) {
|
||||
if ($options->{format} ne 'null') {
|
||||
#<<< perltidy 20220613 formatting
|
||||
if (any { $_ eq $options->{variant} } ('extract', 'custom')
|
||||
and $options->{mode} eq 'fakechroot') {
|
||||
info "creating a tarball, squashfs, ext2 or ext4 image in"
|
||||
|
@ -6810,6 +6817,7 @@ sub main() {
|
|||
. " custom variants because there might be no tar inside the"
|
||||
. " chroot";
|
||||
}
|
||||
#>>>
|
||||
# try to fail early if target tarball or squashfs image cannot be
|
||||
# opened for writing
|
||||
if ($options->{target} ne '-') {
|
||||
|
@ -6840,12 +6848,14 @@ sub main() {
|
|||
# in unshare and root mode, other users than the current user need to
|
||||
# access the rootfs, most prominently, the _apt user. Thus, make the
|
||||
# temporary directory world readable.
|
||||
#<<< perltidy 20220613 formatting
|
||||
if (
|
||||
any { $_ eq $options->{mode} } ('unshare', 'root')
|
||||
or ($EFFECTIVE_USER_ID == 0 and $options->{mode} eq 'chrootless')
|
||||
) {
|
||||
chmod 0755, $options->{root} or error "cannot chmod root: $!";
|
||||
}
|
||||
#>>>
|
||||
} elsif ($options->{format} eq 'directory') {
|
||||
# user does not seem to have specified a tarball as output, thus work
|
||||
# directly in the supplied directory
|
||||
|
@ -7331,9 +7341,11 @@ sub main() {
|
|||
error "cannot copy to standard output: $!";
|
||||
}
|
||||
} else {
|
||||
#<<< perltidy 20220613 formatting
|
||||
if (any { $_ eq $options->{format} }
|
||||
('squashfs', 'ext2', 'ext4')
|
||||
or defined $tar_compressor) {
|
||||
#>>>
|
||||
my @argv = ();
|
||||
if ($options->{format} eq 'squashfs') {
|
||||
push @argv, 'tar2sqfs',
|
||||
|
|
|
@ -3,6 +3,7 @@ set -eu
|
|||
export LC_ALL=C.UTF-8
|
||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||
trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM
|
||||
before=$(tar --one-file-system --anchored --exclude="./var/log/journal/*" --exclude=./var/log/wtmp -C / -c ./usr ./bin ./etc ./lib ./sbin ./var | md5sum)
|
||||
for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do
|
||||
for MODE in root chrootless; do
|
||||
{{ CMD }} --mode=$MODE --variant={{ VARIANT }} \
|
||||
|
@ -12,3 +13,8 @@ for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do
|
|||
cmp /tmp/root.tar /tmp/chrootless.tar || diffoscope /tmp/root.tar /tmp/chrootless.tar
|
||||
rm /tmp/chrootless.tar /tmp/root.tar
|
||||
done
|
||||
after=$(tar --one-file-system --anchored --exclude="./var/log/journal/*" --exclude=./var/log/wtmp -C / -c ./usr ./bin ./etc ./lib ./sbin ./var | md5sum)
|
||||
if [ "$before" != "$after" ]; then
|
||||
echo "found changes outside the chroot" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -3,11 +3,14 @@ set -eu
|
|||
export LC_ALL=C.UTF-8
|
||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||
|
||||
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
|
||||
trap "rm -f /tmp/debian-chroot1.tar /tmp/debian-chroot2.tar" EXIT INT TERM
|
||||
|
||||
{{ CMD }} --variant={{ VARIANT }} --verbose \
|
||||
{{ CMD }} --variant={{ VARIANT }} \
|
||||
{{ DIST }} /tmp/debian-chroot1.tar {{ MIRROR }}
|
||||
|
||||
{{ CMD }} --variant={{ VARIANT }} \
|
||||
--setup-hook='echo deb {{ MIRROR }} {{ DIST }} main >> "$1"/etc/apt/sources.list' \
|
||||
'' /tmp/debian-chroot.tar
|
||||
'' /tmp/debian-chroot2.tar
|
||||
|
||||
cmp ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.tar /tmp/debian-chroot.tar \
|
||||
|| diffoscope ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.tar /tmp/debian-chroot.tar
|
||||
cmp /tmp/debian-chroot1.tar /tmp/debian-chroot2.tar \
|
||||
|| diffoscope /tmp/debian-chroot1.tar /tmp/debian-chroot2.tar
|
||||
|
|
Loading…
Reference in a new issue