Compare commits

..

2 commits

Author SHA1 Message Date
9a9543238b
release 0.9.0 2022-05-27 08:01:22 +02:00
aaab077c2d
wip 2022-05-26 07:36:22 +02:00
40 changed files with 105 additions and 125 deletions

View file

@ -1,9 +1,8 @@
1.0.0 (2022-05-28) 0.9.0 (2022-05-26)
------------------ ------------------
- all documented interfaces are now considered stable
- allow file:// mirrors - allow file:// mirrors
- /var/cache/apt/archives/ is now allowed to contain *.deb packages - /var/cache/apt/archives/ is now allowed to contain packages
- add file-mirror-automount hook-dir - add file-mirror-automount hook-dir
- set $MMDEBSTRAP_VERBOSITY in hooks - set $MMDEBSTRAP_VERBOSITY in hooks
- rewrite coverage with multiple individual and skippable shell scripts - rewrite coverage with multiple individual and skippable shell scripts

View file

@ -6,9 +6,6 @@ import sys
import shutil import shutil
import subprocess import subprocess
import argparse import argparse
import time
from datetime import timedelta
from collections import defaultdict
have_qemu = os.getenv("HAVE_QEMU", "yes") == "yes" have_qemu = os.getenv("HAVE_QEMU", "yes") == "yes"
have_unshare = os.getenv("HAVE_UNSHARE", "yes") == "yes" have_unshare = os.getenv("HAVE_UNSHARE", "yes") == "yes"
@ -17,7 +14,7 @@ run_ma_same_tests = os.getenv("RUN_MA_SAME_TESTS", "yes") == "yes"
default_dist = os.getenv("DEFAULT_DIST", "unstable") default_dist = os.getenv("DEFAULT_DIST", "unstable")
all_dists = ["oldstable", "stable", "testing", "unstable"] all_dists = ["oldstable", "stable", "testing", "unstable"]
default_mode = "auto" if have_unshare else "root" default_mode = "unshare" if have_unshare else "root"
all_modes = ["auto", "root", "unshare", "fakechroot", "chrootless"] all_modes = ["auto", "root", "unshare", "fakechroot", "chrootless"]
default_variant = "apt" default_variant = "apt"
all_variants = [ all_variants = [
@ -38,20 +35,18 @@ only_dists = []
mirror = os.getenv("mirror", "http://127.0.0.1/debian") mirror = os.getenv("mirror", "http://127.0.0.1/debian")
hostarch = subprocess.check_output(["dpkg", "--print-architecture"]).decode().strip() hostarch = subprocess.check_output(["dpkg", "--print-architecture"]).decode().strip()
separator = (
"------------------------------------------------------------------------------"
)
def skip(condition, dist, mode, variant, fmt): def skip(condition, dist, mode, variant, fmt):
if not condition: if not condition:
return "" return False
toskip = False
for line in condition.splitlines(): for line in condition.splitlines():
if not line: if not line:
continue continue
if eval(line): if eval(line):
return line.strip() toskip = True
return "" break
return toskip
def main(): def main():
@ -84,8 +79,19 @@ def main():
with open("coverage.txt") as f: with open("coverage.txt") as f:
for test in Deb822.iter_paragraphs(f): for test in Deb822.iter_paragraphs(f):
name = test["Test"] name = test["Test"]
if args.test and name not in args.test: if args.test and name not in args.text:
continue continue
tt = None
if have_qemu:
tt = "qemu"
elif test.get("Needs-QEMU", "false") == "true":
tt = "skip"
elif test.get("Needs-Root", "false") == "true":
tt = "sudo"
elif have_unshare:
tt = "null"
else:
tt = "sudo"
dists = test.get("Dists", default_dist) dists = test.get("Dists", default_dist)
if dists == "any": if dists == "any":
dists = all_dists dists = all_dists
@ -120,43 +126,24 @@ def main():
for mode in modes: for mode in modes:
for variant in variants: for variant in variants:
for fmt in formats: for fmt in formats:
skipreason = skip( if skip(test.get("Skip-If"), dist, mode, variant, fmt):
test.get("Skip-If"), dist, mode, variant, fmt tt = "skip"
)
if skipreason:
tt = ("skip", skipreason)
elif have_qemu:
tt = "qemu"
elif test.get("Needs-QEMU", "false") == "true":
tt = ("skip", "test needs QEMU")
elif test.get("Needs-Root", "false") == "true":
tt = "sudo"
elif mode == "auto" and not have_unshare:
tt = "sudo"
elif mode == "root":
tt = "sudo"
elif mode == "unshare" and not have_unshare:
tt = ("skip", "test needs unshare")
else:
tt = "null"
tests.append((tt, name, dist, mode, variant, fmt)) tests.append((tt, name, dist, mode, variant, fmt))
starttime = time.time() skipped = []
skipped = defaultdict(list)
failed = [] failed = []
for i, (test, name, dist, mode, variant, fmt) in enumerate(tests): for i, (test, name, dist, mode, variant, fmt) in enumerate(tests):
print(separator, file=sys.stderr) print(
print("(%d/%d) %s" % (i + 1, len(tests), name), file=sys.stderr) "------------------------------------------------------------------------------"
print("dist: %s" % dist, file=sys.stderr) )
print("mode: %s" % mode, file=sys.stderr) print("(%d/%d) %s" % (i + 1, len(tests), name))
print("variant: %s" % variant, file=sys.stderr) print("dist: %s" % dist)
print("format: %s" % fmt, file=sys.stderr) print("mode: %s" % mode)
if i > 0: print("variant: %s" % variant)
currenttime = time.time() print("format: %s" % fmt)
timeleft = timedelta( print(
seconds=(len(tests) - i) * (currenttime - starttime) / i "------------------------------------------------------------------------------"
) )
print("time left: %s" % timeleft, file=sys.stderr)
with open("tests/" + name) as fin, open("shared/test.sh", "w") as fout: with open("tests/" + name) as fin, open("shared/test.sh", "w") as fout:
for line in fin: for line in fin:
for e in ["CMD", "SOURCE_DATE_EPOCH"]: for e in ["CMD", "SOURCE_DATE_EPOCH"]:
@ -176,43 +163,27 @@ def main():
argv = ["./run_null.sh", "SUDO"] argv = ["./run_null.sh", "SUDO"]
case "null": case "null":
argv = ["./run_null.sh"] argv = ["./run_null.sh"]
case ("skip", reason): case "skip":
skipped[reason].append( skipped.append((name, dist, mode, variant, fmt))
("(%d/%d) %s" % (i + 1, len(tests), name), dist, mode, variant, fmt)
)
print(f"skipped because of {reason}", file=sys.stderr)
continue continue
print(separator, file=sys.stderr)
proc = subprocess.Popen(argv) proc = subprocess.Popen(argv)
try: try:
proc.wait() proc.wait()
except KeyboardInterrupt: except KeyboardInterrupt:
proc.kill() proc.kill()
break break
print(separator, file=sys.stderr)
if proc.returncode != 0: if proc.returncode != 0:
failed.append( failed.append((name, dist, mode, variant, fmt))
("(%d/%d) %s" % (i + 1, len(tests), name), dist, mode, variant, fmt)
)
print("result: FAILURE", file=sys.stderr)
else:
print("result: SUCCESS", file=sys.stderr)
if args.maxfail and len(failed) >= args.maxfail: if args.maxfail and len(failed) >= args.maxfail:
break break
print(
"successully ran %d tests" % (len(tests) - len(skipped) - len(failed)),
file=sys.stderr,
)
if skipped: if skipped:
print("skipped %d:" % len(skipped), file=sys.stderr) print("skipped:")
for reason, l in skipped.items(): for t in skipped:
print(f"skipped because of {reason}:", file=sys.stderr) print(t)
for t in l:
print(f" {t}", file=sys.stderr)
if failed: if failed:
print("failed %d:" % len(failed), file=sys.stderr) print("failed:")
for t in failed: for t in failed:
print(f" {t}", file=sys.stderr) print(t)
exit(1) exit(1)

View file

@ -2,7 +2,7 @@
set -eu set -eu
if [ -e ./mmdebstrap -a -e ./taridshift -a -e ./tarfilter -a -e ./coverage.py ]; then if [ -e ./mmdebstrap -a -e ./taridshift -a -e ./tarfilter ]; then
TMPFILE=$(mktemp) TMPFILE=$(mktemp)
perltidy < ./mmdebstrap > "$TMPFILE" perltidy < ./mmdebstrap > "$TMPFILE"
ret=0 ret=0
@ -21,7 +21,7 @@ if [ -e ./mmdebstrap -a -e ./taridshift -a -e ./tarfilter -a -e ./coverage.py ];
perlcritic --severity 4 --verbose 8 ./mmdebstrap perlcritic --severity 4 --verbose 8 ./mmdebstrap
black --check ./taridshift ./tarfilter ./coverage.py black --check ./taridshift ./tarfilter
fi fi
mirrordir="./shared/cache/debian" mirrordir="./shared/cache/debian"

View file

@ -1,10 +1,8 @@
Test: check-against-debootstrap-dist Test: check-against-debootstrap-dist
Dists: any Dists: any
Variants: minbase buildd - Variants: minbase buildd -
Needs-Root: true
Test: as-debootstrap-unshare-wrapper Test: as-debootstrap-unshare-wrapper
Needs-QEMU: true
Test: help Test: help

View file

@ -23,7 +23,7 @@
use strict; use strict;
use warnings; use warnings;
our $VERSION = '1.0.0'; our $VERSION = '0.9.0';
use English; use English;
use Getopt::Long; use Getopt::Long;
@ -1072,7 +1072,7 @@ sub run_chroot {
} }
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
unlink "$options->{root}/dev/$fname" unlink "$options->{root}/dev/$fname"
or warning("cannot unlink ./dev/$fname: $!"); or warn "cannot unlink ./dev/$fname: $!";
}; };
symlink $linkname, "$options->{root}/dev/$fname" symlink $linkname, "$options->{root}/dev/$fname"
or error or error
@ -1114,9 +1114,9 @@ sub run_chroot {
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
0 == system('umount', @umountopts, 0 == system('umount', @umountopts,
"$options->{root}/dev/$fname") "$options->{root}/dev/$fname")
or warning("umount ./dev/$fname failed: $?"); or warn "umount ./dev/$fname failed: $?";
unlink "$options->{root}/dev/$fname" unlink "$options->{root}/dev/$fname"
or warning("cannot unlink ./dev/$fname: $!"); or warn "cannot unlink ./dev/$fname: $!";
}; };
0 == system('mount', '-o', 'bind', "/dev/$fname", 0 == system('mount', '-o', 'bind', "/dev/$fname",
"$options->{root}/dev/$fname") "$options->{root}/dev/$fname")
@ -1150,7 +1150,7 @@ sub run_chroot {
# was already created in the run_setup function. # was already created in the run_setup function.
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
rmdir "$options->{root}/dev/$fname" rmdir "$options->{root}/dev/$fname"
or warning("cannot rmdir ./dev/$fname: $!"); or warn "cannot rmdir ./dev/$fname: $!";
}; };
if (-e "$options->{root}/dev/$fname") { if (-e "$options->{root}/dev/$fname") {
if (!-d "$options->{root}/dev/$fname") { if (!-d "$options->{root}/dev/$fname") {
@ -1185,7 +1185,7 @@ sub run_chroot {
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
0 == system('umount', @umountopts, 0 == system('umount', @umountopts,
"$options->{root}/dev/$fname") "$options->{root}/dev/$fname")
or warning("umount ./dev/$fname failed: $?"); or warn "umount ./dev/$fname failed: $?";
}; };
0 == system('mount', '-o', 'bind', "/dev/$fname", 0 == system('mount', '-o', 'bind', "/dev/$fname",
"$options->{root}/dev/$fname") "$options->{root}/dev/$fname")
@ -1236,7 +1236,7 @@ sub run_chroot {
) { ) {
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
0 == system('umount', "$options->{root}/sys") 0 == system('umount', "$options->{root}/sys")
or warning("umount /sys failed: $?"); or warn "umount /sys failed: $?";
}; };
} elsif ( } elsif (
0 == system('mount', '-o', 'rbind', '/sys', 0 == system('mount', '-o', 'rbind', '/sys',
@ -1247,7 +1247,7 @@ sub run_chroot {
0 == system( 0 == system(
'umount', '--no-mtab', 'umount', '--no-mtab',
'--lazy', "$options->{root}/sys" '--lazy', "$options->{root}/sys"
) or warning("umount /sys failed: $?"); ) or warn "umount /sys failed: $?";
}; };
} else { } else {
error "mount /sys failed: $?"; error "mount /sys failed: $?";
@ -1263,7 +1263,7 @@ sub run_chroot {
# unmounting /sys only seems to be successful with --lazy # unmounting /sys only seems to be successful with --lazy
0 == system('umount', '--no-mtab', '--lazy', 0 == system('umount', '--no-mtab', '--lazy',
"$options->{root}/sys") "$options->{root}/sys")
or warning("umount /sys failed: $?"); or warn "umount /sys failed: $?";
}; };
# without the network namespace unshared, we cannot mount a new # without the network namespace unshared, we cannot mount a new
# sysfs. Since we need network, we just bind-mount. # sysfs. Since we need network, we just bind-mount.
@ -1317,11 +1317,11 @@ sub run_chroot {
) { ) {
0 == system('umount', 0 == system('umount',
"$options->{root}/proc/sys/fs/binfmt_misc") "$options->{root}/proc/sys/fs/binfmt_misc")
or warning( or error
"umount /proc/sys/fs/binfmt_misc failed: $?"); "umount /proc/sys/fs/binfmt_misc failed: $?";
} }
0 == system('umount', "$options->{root}/proc") 0 == system('umount', "$options->{root}/proc")
or warning("umount /proc failed: $?"); or error "umount /proc failed: $?";
}; };
} elsif ( } elsif (
0 == system('mount', '-t', 'proc', 'proc', 0 == system('mount', '-t', 'proc', 'proc',
@ -1329,7 +1329,7 @@ sub run_chroot {
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
# since we cannot write to /etc/mtab we need --no-mtab # since we cannot write to /etc/mtab we need --no-mtab
0 == system('umount', '--no-mtab', "$options->{root}/proc") 0 == system('umount', '--no-mtab', "$options->{root}/proc")
or warning("umount /proc failed: $?"); or error "umount /proc failed: $?";
}; };
} else { } else {
error "mount /proc failed: $?"; error "mount /proc failed: $?";
@ -1343,7 +1343,7 @@ sub run_chroot {
push @cleanup_tasks, sub { push @cleanup_tasks, sub {
# since we cannot write to /etc/mtab we need --no-mtab # since we cannot write to /etc/mtab we need --no-mtab
0 == system('umount', '--no-mtab', "$options->{root}/proc") 0 == system('umount', '--no-mtab', "$options->{root}/proc")
or warning("umount /proc failed: $?"); or error "umount /proc failed: $?";
}; };
0 == system('mount', '-t', 'proc', 'proc', "$options->{root}/proc") 0 == system('mount', '-t', 'proc', 'proc', "$options->{root}/proc")
or error "mount /proc failed: $?"; or error "mount /proc failed: $?";

View file

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/config" EXIT INT TERM
echo 'Acquire::Languages "none";' > /tmp/config echo 'Acquire::Languages "none";' > /tmp/config
{{ CMD }} --mode=root --variant=apt --aptopt='Acquire::Check-Valid-Until "false"' --aptopt=/tmp/config {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt --aptopt='Acquire::Check-Valid-Until "false"' --aptopt=/tmp/config {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
printf 'Acquire::Check-Valid-Until "false";\nAcquire::Languages "none";\n' | cmp /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap - printf 'Acquire::Check-Valid-Until "false";\nAcquire::Languages "none";\n' | cmp /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap -
rm /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap rm /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot /tmp/config

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=custom \ {{ CMD }} --mode={{ MODE }} --variant=custom \
--include $(cat pkglist.txt | tr '\n' ',') \ --include $(cat pkglist.txt | tr '\n' ',') \
--aptopt='APT::Solver "aspcud"' \ --aptopt='APT::Solver "aspcud"' \
@ -9,3 +8,4 @@ trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
tar -tf /tmp/debian-chroot.tar | sort \ tar -tf /tmp/debian-chroot.tar | sort \
| grep -v '^./etc/apt/apt.conf.d/99mmdebstrap$' \ | grep -v '^./etc/apt/apt.conf.d/99mmdebstrap$' \
| diff -u tar1.txt - | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
mkdir /tmp/debian-chroot mkdir /tmp/debian-chroot
chmod 700 /tmp/debian-chroot chmod 700 /tmp/debian-chroot
{{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -7,7 +7,7 @@ set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
prefix= prefix=
include= include=
if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != root ] && [ "{{ MODE }}" != auto ]; then if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != root ]; then
# this must be qemu # this must be qemu
if ! id -u user >/dev/null 2>&1; then if ! id -u user >/dev/null 2>&1; then
if [ ! -e /mmdebstrap-testenv ]; then if [ ! -e /mmdebstrap-testenv ]; then

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/customize.sh" EXIT INT TERM
cat << 'SCRIPT' > /tmp/customize.sh cat << 'SCRIPT' > /tmp/customize.sh
#!/bin/sh #!/bin/sh
chroot "$1" whoami > "$1/output2" chroot "$1" whoami > "$1/output2"
@ -14,3 +13,5 @@ printf "root\n/\n" | cmp /tmp/debian-chroot/output2
rm /tmp/debian-chroot/output1 rm /tmp/debian-chroot/output1
rm /tmp/debian-chroot/output2 rm /tmp/debian-chroot/output2
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm /tmp/customize.sh
rm -r /tmp/debian-chroot

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/sources.list /tmp/deb822.sources" EXIT INT TERM
cat << SOURCES > /tmp/deb822.sources cat << SOURCES > /tmp/deb822.sources
Types: deb Types: deb
URIs: {{ MIRROR }}1 URIs: {{ MIRROR }}1
@ -43,3 +42,5 @@ tar -C /tmp/debian-chroot --one-file-system -c . \
| grep -v "^./etc/apt/sources.list.d/0002sources.list"; | grep -v "^./etc/apt/sources.list.d/0002sources.list";
printf "./etc/apt/sources.list\n"; printf "./etc/apt/sources.list\n";
} | sort | diff -u tar1.txt - } | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot
rm /tmp/sources.list /tmp/deb822.sources

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/sources /tmp/deb822" EXIT INT TERM
cat << SOURCES > /tmp/deb822 cat << SOURCES > /tmp/deb822
Types: deb Types: deb
URIs: {{ MIRROR }}1 URIs: {{ MIRROR }}1
@ -42,3 +41,5 @@ tar -C /tmp/debian-chroot --one-file-system -c . \
| grep -v "^./etc/apt/sources.list.d/0002sources.list$"; | grep -v "^./etc/apt/sources.list.d/0002sources.list$";
printf "./etc/apt/sources.list\n"; printf "./etc/apt/sources.list\n";
} | sort | diff -u tar1.txt - } | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot
rm /tmp/sources /tmp/deb822

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
script -qfc "{{ CMD }} --mode={{ MODE }} --debug --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}" /dev/null script -qfc "{{ CMD }} --mode={{ MODE }} --debug --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}" /dev/null
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -2,7 +2,6 @@
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
[ "$(whoami)" = "root" ] [ "$(whoami)" = "root" ]
trap "rm -rf /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=apt --format=directory {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt --format=directory {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
ftype=$(stat -c %F /tmp/debian-chroot.tar) ftype=$(stat -c %F /tmp/debian-chroot.tar)
if [ "$ftype" != directory ]; then if [ "$ftype" != directory ]; then
@ -10,3 +9,4 @@ if [ "$ftype" != directory ]; then
exit 1 exit 1
fi fi
tar -C /tmp/debian-chroot.tar --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot.tar --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot.tar

View file

@ -4,8 +4,9 @@
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f Release; rm -rf /tmp/debian-chroot" EXIT INT TERM
/usr/lib/apt/apt-helper download-file "{{ MIRROR }}/dists/{{ DIST }}/Release" Release /usr/lib/apt/apt-helper download-file "{{ MIRROR }}/dists/{{ DIST }}/Release" Release
codename=$(awk '/^Codename: / { print $2; }' Release) codename=$(awk '/^Codename: / { print $2; }' Release)
rm Release
{{ CMD }} --mode={{ MODE }} --variant=apt $codename /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt $codename /tmp/debian-chroot {{ MIRROR }}
echo "deb {{ MIRROR }} $codename main" | diff -u - /tmp/debian-chroot/etc/apt/sources.list echo "deb {{ MIRROR }} $codename main" | diff -u - /tmp/debian-chroot/etc/apt/sources.list
rm -rf /tmp/debian-chroot

View file

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/config" EXIT INT TERM
echo no-pager > /tmp/config echo no-pager > /tmp/config
{{ CMD }} --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" --dpkgopt=/tmp/config --dpkgopt="path-include=/usr/share/doc/dpkg/copyright" {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" --dpkgopt=/tmp/config --dpkgopt="path-include=/usr/share/doc/dpkg/copyright" {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
printf 'path-exclude=/usr/share/doc/*\nno-pager\npath-include=/usr/share/doc/dpkg/copyright\n' | cmp /tmp/debian-chroot/etc/dpkg/dpkg.cfg.d/99mmdebstrap - printf 'path-exclude=/usr/share/doc/*\nno-pager\npath-include=/usr/share/doc/dpkg/copyright\n' | cmp /tmp/debian-chroot/etc/dpkg/dpkg.cfg.d/99mmdebstrap -
rm /tmp/debian-chroot/etc/dpkg/dpkg.cfg.d/99mmdebstrap rm /tmp/debian-chroot/etc/dpkg/dpkg.cfg.d/99mmdebstrap
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort > tar2.txt tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort > tar2.txt
{ grep -v '^./usr/share/doc/.' tar1.txt; echo ./usr/share/doc/dpkg/; echo ./usr/share/doc/dpkg/copyright; } | sort | diff -u - tar2.txt { grep -v '^./usr/share/doc/.' tar1.txt; echo ./usr/share/doc/dpkg/; echo ./usr/share/doc/dpkg/copyright; } | sort | diff -u - tar2.txt
rm -r /tmp/debian-chroot /tmp/config

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rm -f /tmp/essential.sh" EXIT INT TERM
cat << 'SCRIPT' > /tmp/essential.sh cat << 'SCRIPT' > /tmp/essential.sh
#!/bin/sh #!/bin/sh
echo tzdata tzdata/Zones/Europe select Berlin | chroot "$1" debconf-set-selections echo tzdata tzdata/Zones/Europe select Berlin | chroot "$1" debconf-set-selections
@ -18,3 +17,5 @@ tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort \
| grep -v '^./var/lib/dpkg/info/tzdata.' \ | grep -v '^./var/lib/dpkg/info/tzdata.' \
| grep -v '^./var/lib/apt/extended_states$' \ | grep -v '^./var/lib/apt/extended_states$' \
| diff -u tar1.txt - | diff -u tar1.txt -
rm /tmp/essential.sh
rm -r /tmp/debian-chroot

View file

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
mkdir /tmp/debian-chroot mkdir /tmp/debian-chroot
mkdir /tmp/debian-chroot/lost+found mkdir /tmp/debian-chroot/lost+found
{{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
rmdir /tmp/debian-chroot/lost+found rmdir /tmp/debian-chroot/lost+found
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
mkdir /tmp/debian-chroot mkdir /tmp/debian-chroot
{{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -1,12 +1,14 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm /tmp/debian-chroot/lost+found/exists; rmdir /tmp/debian-chroot/lost+found /tmp/debian-chroot" EXIT INT TERM
mkdir /tmp/debian-chroot mkdir /tmp/debian-chroot
mkdir /tmp/debian-chroot/lost+found mkdir /tmp/debian-chroot/lost+found
touch /tmp/debian-chroot/lost+found/exists touch /tmp/debian-chroot/lost+found/exists
ret=0 ret=0
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} || ret=$? {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} || ret=$?
rm /tmp/debian-chroot/lost+found/exists
rmdir /tmp/debian-chroot/lost+found
rmdir /tmp/debian-chroot
if [ "$ret" = 0 ]; then if [ "$ret" = 0 ]; then
echo expected failure but got exit $ret >&2 echo expected failure but got exit $ret >&2
exit 1 exit 1

View file

@ -1,12 +1,14 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rmdir /tmp/debian-chroot/lost+found; rm /tmp/debian-chroot/exists; rmdir /tmp/debian-chroot" EXIT INT TERM
mkdir /tmp/debian-chroot mkdir /tmp/debian-chroot
mkdir /tmp/debian-chroot/lost+found mkdir /tmp/debian-chroot/lost+found
touch /tmp/debian-chroot/exists touch /tmp/debian-chroot/exists
ret=0 ret=0
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} || ret=$? {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} || ret=$?
rmdir /tmp/debian-chroot/lost+found
rm /tmp/debian-chroot/exists
rmdir /tmp/debian-chroot
if [ "$ret" = 0 ]; then if [ "$ret" = 0 ]; then
echo expected failure but got exit $ret >&2 echo expected failure but got exit $ret >&2
exit 1 exit 1

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode=root --variant=apt --include=doc-debian {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt --include=doc-debian {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
rm /tmp/debian-chroot/usr/share/doc-base/debian-* rm /tmp/debian-chroot/usr/share/doc-base/debian-*
rm -r /tmp/debian-chroot/usr/share/doc/debian rm -r /tmp/debian-chroot/usr/share/doc/debian
@ -10,3 +9,4 @@ rm /tmp/debian-chroot/var/lib/apt/extended_states
rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.list rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.list
rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.md5sums rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.md5sums
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -5,6 +5,6 @@
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode=root --variant=minbase --include=doc-debian unstable /tmp/debian-chroot "deb {{ MIRROR }} unstable main" "deb {{ MIRROR }} stable main" {{ CMD }} --mode=root --variant=minbase --include=doc-debian unstable /tmp/debian-chroot "deb {{ MIRROR }} unstable main" "deb {{ MIRROR }} stable main"
chroot /tmp/debian-chroot dpkg-query --show doc-debian chroot /tmp/debian-chroot dpkg-query --show doc-debian
rm -r /tmp/debian-chroot

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot; rmdir /tmp/emptydir; rm -f /tmp/emptyfile" EXIT INT TERM
mkdir -p /tmp/emptydir mkdir -p /tmp/emptydir
touch /tmp/emptyfile touch /tmp/emptyfile
# this overwrites the apt keyring options and should fail # this overwrites the apt keyring options and should fail
@ -9,6 +8,9 @@ ret=0
{{ CMD }} --mode=root --variant=apt --keyring=/tmp/emptydir --keyring=/tmp/emptyfile {{ DIST }} /tmp/debian-chroot "deb {{ MIRROR }} {{ DIST }} main" || ret=$? {{ CMD }} --mode=root --variant=apt --keyring=/tmp/emptydir --keyring=/tmp/emptyfile {{ DIST }} /tmp/debian-chroot "deb {{ MIRROR }} {{ DIST }} main" || ret=$?
# make sure that no [signedby=...] managed to make it into the sources.list # make sure that no [signedby=...] managed to make it into the sources.list
echo "deb {{ MIRROR }} {{ DIST }} main" | cmp /tmp/debian-chroot/etc/apt/sources.list - echo "deb {{ MIRROR }} {{ DIST }} main" | cmp /tmp/debian-chroot/etc/apt/sources.list -
rm -r /tmp/debian-chroot
rmdir /tmp/emptydir
rm /tmp/emptyfile
if [ "$ret" = 0 ]; then if [ "$ret" = 0 ]; then
echo expected failure but got exit $ret >&2 echo expected failure but got exit $ret >&2
exit 1 exit 1

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode=root --variant=apt \ {{ CMD }} --mode=root --variant=apt \
--setup-hook=./hooks/merged-usr/setup00.sh \ --setup-hook=./hooks/merged-usr/setup00.sh \
--customize-hook='[ -L "$1"/bin -a -L "$1"/sbin -a -L "$1"/lib ]' \ --customize-hook='[ -L "$1"/bin -a -L "$1"/sbin -a -L "$1"/lib ]' \
@ -41,3 +40,4 @@ tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort > tar2.txt
;; ;;
esac esac
} | sort -u | diff -u - tar2.txt } | sort -u | diff -u - tar2.txt
rm -r /tmp/debian-chroot

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar "deb {{ MIRROR }} {{ DIST }} main" {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar "deb {{ MIRROR }} {{ DIST }} main"
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar /tmp/sources.list" EXIT INT TERM
echo "deb {{ MIRROR }} {{ DIST }} main" > /tmp/sources.list echo "deb {{ MIRROR }} {{ DIST }} main" > /tmp/sources.list
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar /tmp/sources.list {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar /tmp/sources.list
tar -tf /tmp/debian-chroot.tar \ tar -tf /tmp/debian-chroot.tar \
| sed 's#^./etc/apt/sources.list.d/0000sources.list$#./etc/apt/sources.list#' \ | sed 's#^./etc/apt/sources.list.d/0000sources.list$#./etc/apt/sources.list#' \
| sort | diff -u tar1.txt - | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar /tmp/sources.list

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
echo "deb {{ MIRROR }} {{ DIST }} main" | {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar - echo "deb {{ MIRROR }} {{ DIST }} main" | {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar -
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode=root --variant=apt --include=doc-debian --include=tzdata {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt --include=doc-debian --include=tzdata {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
rm /tmp/debian-chroot/usr/share/doc-base/debian-* rm /tmp/debian-chroot/usr/share/doc-base/debian-*
rm -r /tmp/debian-chroot/usr/share/doc/debian rm -r /tmp/debian-chroot/usr/share/doc/debian
@ -21,3 +20,4 @@ rm /tmp/debian-chroot/var/lib/dpkg/info/tzdata.postinst
rm /tmp/debian-chroot/var/lib/dpkg/info/tzdata.postrm rm /tmp/debian-chroot/var/lib/dpkg/info/tzdata.postrm
rm /tmp/debian-chroot/var/lib/dpkg/info/tzdata.templates rm /tmp/debian-chroot/var/lib/dpkg/info/tzdata.templates
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=essential --include=apt \ {{ CMD }} --mode={{ MODE }} --variant=essential --include=apt \
--essential-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get update' \ --essential-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get update' \
--essential-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install -oDPkg::Chroot-Directory="$1" apt' \ --essential-hook='APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install -oDPkg::Chroot-Directory="$1" apt' \
{{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
tar -tf /tmp/debian-chroot.tar | sort | grep -v ./var/lib/apt/extended_states | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | grep -v ./var/lib/apt/extended_states | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
script -qfc "{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}" /dev/null script -qfc "{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}" /dev/null
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm /tmp/debian-chroot.tar" EXIT INT TERM
echo "deb {{ MIRROR }} {{ DIST }} main" | {{ CMD }} --mode={{ MODE }} --variant=apt > /tmp/debian-chroot.tar echo "deb {{ MIRROR }} {{ DIST }} main" | {{ CMD }} --mode={{ MODE }} --variant=apt > /tmp/debian-chroot.tar
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=apt --customize-hook='rm "$1/usr/sbin/policy-rc.d"; rm "$1/sbin/start-stop-daemon"' {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt --customize-hook='rm "$1/usr/sbin/policy-rc.d"; rm "$1/sbin/start-stop-daemon"' {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode=root --variant=apt {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
printf 'deb {{ MIRROR }} {{ DIST }} main\n' | cmp /tmp/debian-chroot/etc/apt/sources.list - printf 'deb {{ MIRROR }} {{ DIST }} main\n' | cmp /tmp/debian-chroot/etc/apt/sources.list -
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -rf /tmp/debian-chroot" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=apt --components="main main" --comp="main,main" {{ DIST }} /tmp/debian-chroot {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt --components="main main" --comp="main,main" {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
echo "deb {{ MIRROR }} {{ DIST }} main" | cmp /tmp/debian-chroot/etc/apt/sources.list echo "deb {{ MIRROR }} {{ DIST }} main" | cmp /tmp/debian-chroot/etc/apt/sources.list
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt - tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot

View file

@ -5,7 +5,6 @@ if [ ! -e /mmdebstrap-testenv ]; then
echo "this test modifies the system and should only be run inside a container" >&2 echo "this test modifies the system and should only be run inside a container" >&2
exit 1 exit 1
fi fi
trap "rm -f /tmp/debian-chroot.tar /tmp/debian-chroot-shifted.tar /tmp/debian-chroot.txt /tmp/debian-chroot-shiftedback.tar /tmp/expected; rm -rf /tmp/debian-chroot" EXIT INT TERM
adduser --gecos user --disabled-password user adduser --gecos user --disabled-password user
echo user:100000:65536 | cmp /etc/subuid - echo user:100000:65536 | cmp /etc/subuid -
echo user:100000:65536 | cmp /etc/subgid - echo user:100000:65536 | cmp /etc/subgid -
@ -57,3 +56,5 @@ runuser -u user -- {{ CMD }} --unshare-helper /usr/sbin/chroot /tmp/debian-chroo
echo "/bin/ping cap_net_raw=ep" > /tmp/expected echo "/bin/ping cap_net_raw=ep" > /tmp/expected
runuser -u user -- {{ CMD }} --unshare-helper /usr/sbin/chroot /tmp/debian-chroot getcap /bin/ping \ runuser -u user -- {{ CMD }} --unshare-helper /usr/sbin/chroot /tmp/debian-chroot getcap /bin/ping \
| diff -u /tmp/expected - | diff -u /tmp/expected -
rm /tmp/debian-chroot.tar /tmp/debian-chroot-shifted.tar /tmp/debian-chroot.txt /tmp/debian-chroot-shiftedback.tar /tmp/expected
rm -r /tmp/debian-chroot

View file

@ -2,8 +2,8 @@
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
[ "$(whoami)" = "root" ] [ "$(whoami)" = "root" ]
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
{{ CMD }} --mode=unshare --variant=apt \ {{ CMD }} --mode=unshare --variant=apt \
--customize-hook='chroot "$1" sh -c "test -e /proc/self/fd"' \ --customize-hook='chroot "$1" sh -c "test -e /proc/self/fd"' \
{{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -8,7 +8,6 @@
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
[ "$(whoami)" = "root" ] [ "$(whoami)" = "root" ]
trap "rm -f /tmp/debian-chroot.tar script.sh" EXIT INT TERM
cat << 'SCRIPT' > script.sh cat << 'SCRIPT' > script.sh
#!/bin/sh #!/bin/sh
set -eu set -eu
@ -26,3 +25,4 @@ chmod +x script.sh
--customize-hook="download /tmp/debian-chroot.tar /tmp/debian-chroot.tar" \ --customize-hook="download /tmp/debian-chroot.tar /tmp/debian-chroot.tar" \
{{ DIST }} /dev/null {{ MIRROR }} {{ DIST }} /dev/null {{ MIRROR }}
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar script.sh

View file

@ -5,10 +5,10 @@ if [ ! -e /mmdebstrap-testenv ]; then
echo "this test modifies the system and should only be run inside a container" >&2 echo "this test modifies the system and should only be run inside a container" >&2
exit 1 exit 1
fi fi
trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM
rm /etc/resolv.conf /etc/hostname rm /etc/resolv.conf /etc/hostname
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
{ tar -tf /tmp/debian-chroot.tar; { tar -tf /tmp/debian-chroot.tar;
printf "./etc/hostname\n"; printf "./etc/hostname\n";
printf "./etc/resolv.conf\n"; printf "./etc/resolv.conf\n";
} | sort | diff -u tar1.txt - } | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
trap "rm -f /tmp/debian-chroot.tar.xz" EXIT INT TERM
{{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar.xz {{ MIRROR }} {{ CMD }} --mode={{ MODE }} --variant=apt {{ DIST }} /tmp/debian-chroot.tar.xz {{ MIRROR }}
printf '\3757zXZ\0' | cmp --bytes=6 /tmp/debian-chroot.tar.xz - printf '\3757zXZ\0' | cmp --bytes=6 /tmp/debian-chroot.tar.xz -
tar -tf /tmp/debian-chroot.tar.xz | sort | diff -u tar1.txt - tar -tf /tmp/debian-chroot.tar.xz | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar.xz