Compare commits
17 commits
5fd96553f5
...
5bab4c1945
Author | SHA1 | Date | |
---|---|---|---|
5bab4c1945 | |||
21c677c7f4 | |||
fd7f6f89c5 | |||
946ef132e2 | |||
a57eba1dbc | |||
65d932d8ba | |||
c682a61468 | |||
ea2b57870b | |||
0b7188ce32 | |||
de8e31193b | |||
e93c145822 | |||
3b953d4398 | |||
9945e65701 | |||
644ac62ecd | |||
eaf96dc7f6 | |||
65ea2edfab | |||
3ba97580ec |
17 changed files with 311 additions and 96 deletions
|
@ -307,7 +307,7 @@ Variants: essential
|
||||||
Modes: chrootless
|
Modes: chrootless
|
||||||
Skip-If:
|
Skip-If:
|
||||||
dist in ["oldstable", "stable"]
|
dist in ["oldstable", "stable"]
|
||||||
hostarch != "amd64"
|
hostarch not in ["amd64", "arm64"]
|
||||||
not run_ma_same_tests
|
not run_ma_same_tests
|
||||||
Needs-QEMU: true
|
Needs-QEMU: true
|
||||||
|
|
||||||
|
|
|
@ -8,41 +8,9 @@ fi
|
||||||
|
|
||||||
TARGET="$1"
|
TARGET="$1"
|
||||||
|
|
||||||
|
# not needed since dpkg 1.17.11
|
||||||
for f in available diversions cmethopt; do
|
for f in available diversions cmethopt; do
|
||||||
if [ ! -e "$TARGET/var/lib/dpkg/$f" ]; then
|
if [ ! -e "$TARGET/var/lib/dpkg/$f" ]; then
|
||||||
touch "$TARGET/var/lib/dpkg/$f"
|
touch "$TARGET/var/lib/dpkg/$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${MMDEBSTRAP_ESSENTIAL+x}" ]; then
|
|
||||||
MMDEBSTRAP_ESSENTIAL=
|
|
||||||
for f in "$TARGET/var/cache/apt/archives/"*.deb; do
|
|
||||||
[ -f "$f" ] || continue
|
|
||||||
f="${f#"$TARGET"}"
|
|
||||||
MMDEBSTRAP_ESSENTIAL="$MMDEBSTRAP_ESSENTIAL $f"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
fname_base_passwd=
|
|
||||||
fname_base_files=
|
|
||||||
fname_dpkg=
|
|
||||||
for pkg in $MMDEBSTRAP_ESSENTIAL; do
|
|
||||||
pkgname=$(dpkg-deb --show --showformat='${Package}' "$TARGET/$pkg")
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
case $pkgname in
|
|
||||||
base-passwd) fname_base_passwd=$pkg;;
|
|
||||||
base-files) fname_base_files=$pkg;;
|
|
||||||
dpkg) fname_dpkg=$pkg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
for var in base_passwd base_files dpkg; do
|
|
||||||
eval 'val=$fname_'"$var"
|
|
||||||
[ -z "$val" ] && continue
|
|
||||||
chroot "$TARGET" dpkg --install --force-depends "$val"
|
|
||||||
done
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
chroot "$TARGET" dpkg --unpack --force-depends $MMDEBSTRAP_ESSENTIAL
|
|
||||||
|
|
||||||
chroot "$TARGET" dpkg --configure --pending
|
|
||||||
|
|
47
hooks/jessie-or-older/extract01.sh
Executable file
47
hooks/jessie-or-older/extract01.sh
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# needed until init 1.33 which pre-depends on systemd-sysv
|
||||||
|
# starting with init 1.34, init is not Essential:yes anymore
|
||||||
|
#
|
||||||
|
# jessie has init 1.22
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET="$1"
|
||||||
|
|
||||||
|
if [ -z "${MMDEBSTRAP_ESSENTIAL+x}" ]; then
|
||||||
|
MMDEBSTRAP_ESSENTIAL=
|
||||||
|
for f in "$TARGET/var/cache/apt/archives/"*.deb; do
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
f="${f#"$TARGET"}"
|
||||||
|
MMDEBSTRAP_ESSENTIAL="$MMDEBSTRAP_ESSENTIAL $f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
fname_base_passwd=
|
||||||
|
fname_base_files=
|
||||||
|
fname_dpkg=
|
||||||
|
for pkg in $MMDEBSTRAP_ESSENTIAL; do
|
||||||
|
pkgname=$(dpkg-deb --show --showformat='${Package}' "$TARGET/$pkg")
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
case $pkgname in
|
||||||
|
base-passwd) fname_base_passwd=$pkg;;
|
||||||
|
base-files) fname_base_files=$pkg;;
|
||||||
|
dpkg) fname_dpkg=$pkg;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
for var in base_passwd base_files dpkg; do
|
||||||
|
eval 'val=$fname_'"$var"
|
||||||
|
[ -z "$val" ] && continue
|
||||||
|
chroot "$TARGET" dpkg --install --force-depends "$val"
|
||||||
|
done
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
chroot "$TARGET" dpkg --unpack --force-depends $MMDEBSTRAP_ESSENTIAL
|
||||||
|
|
||||||
|
chroot "$TARGET" dpkg --configure --pending
|
28
hooks/maybe-jessie-or-older/extract00.sh
Executable file
28
hooks/maybe-jessie-or-older/extract00.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# if dpkg is new enough, do nothing
|
||||||
|
# we cannot ask dpkg-query about the version because dpkg is only extracted
|
||||||
|
# but not installed at this point
|
||||||
|
dpkg_ver="$(chroot "$1" dpkg --version | grep --extended-regexp --only-matching '[0-9]+\.[0-9.]+')"
|
||||||
|
if dpkg --compare-versions "$dpkg_ver" ge 1.17.11; then
|
||||||
|
echo "dpkg version $dpkg_ver is >= 1.17.11 -- not running jessie-or-older extract00 hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "dpkg version $dpkg_ver is << 1.17.11 -- running jessie-or-older extract00 hook" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# resolve the script path using several methods in order:
|
||||||
|
# 1. using dirname -- "$0"
|
||||||
|
# 2. using ./hooks
|
||||||
|
# 3. using /usr/share/mmdebstrap/hooks/
|
||||||
|
for p in "$(dirname -- "$0")/.." ./hooks /usr/share/mmdebstrap/hooks; do
|
||||||
|
if [ -x "$p/jessie-or-older/extract00.sh" ] && [ -x "$p/jessie-or-older/extract01.sh" ]; then
|
||||||
|
"$p/jessie-or-older/extract00.sh" "$1"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "cannot find jessie-or-older hook anywhere" >&2
|
||||||
|
exit 1
|
31
hooks/maybe-jessie-or-older/extract01.sh
Executable file
31
hooks/maybe-jessie-or-older/extract01.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# If the init package has not been extracted, then it is not part of the
|
||||||
|
# Essential:yes set and we do not need this workaround. This holds true for the
|
||||||
|
# init package version 1.34 and later. Instead of asking apt about the init
|
||||||
|
# version (which might not be the same version that was picked to be installed)
|
||||||
|
# we check for the presence of the init package by checking whether
|
||||||
|
# /usr/share/doc/init/copyright exists.
|
||||||
|
|
||||||
|
if [ -e "$1/usr/share/doc/init/copyright" ]; then
|
||||||
|
echo "the init package is not Essential:yes -- not running jessie-or-older extract01 hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "the init package is Essential:yes -- running jessie-or-older extract01 hook" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# resolve the script path using several methods in order:
|
||||||
|
# 1. using dirname -- "$0"
|
||||||
|
# 2. using ./hooks
|
||||||
|
# 3. using /usr/share/mmdebstrap/hooks/
|
||||||
|
for p in "$(dirname -- "$0")/.." ./hooks /usr/share/mmdebstrap/hooks; do
|
||||||
|
if [ -x "$p/jessie-or-older/extract00.sh" ] && [ -x "$p/jessie-or-older/extract01.sh" ]; then
|
||||||
|
"$p/jessie-or-older/extract01.sh" "$1"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "cannot find jessie-or-older hook anywhere" >&2
|
||||||
|
exit 1
|
25
hooks/maybe-merged-usr/essential00.sh
Executable file
25
hooks/maybe-merged-usr/essential00.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# if the usr-is-merged package cannot be installed with apt, do nothing
|
||||||
|
if ! env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
|
||||||
|
echo "no package called usr-is-merged found -- not running merged-usr essential hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "package usr-is-merged found -- running merged-usr essential hook" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# resolve the script path using several methods in order:
|
||||||
|
# 1. using dirname -- "$0"
|
||||||
|
# 2. using ./hooks
|
||||||
|
# 3. using /usr/share/mmdebstrap/hooks/
|
||||||
|
for p in "$(dirname -- "$0")/.." ./hooks /usr/share/mmdebstrap/hooks; do
|
||||||
|
if [ -x "$p/merged-usr/setup00.sh" ] && [ -x "$p/merged-usr/essential00.sh" ]; then
|
||||||
|
"$p/merged-usr/essential00.sh" "$1"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "cannot find merged-usr hook anywhere" >&2
|
||||||
|
exit 1
|
27
hooks/maybe-merged-usr/setup00.sh
Executable file
27
hooks/maybe-merged-usr/setup00.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get update --error-on=any
|
||||||
|
|
||||||
|
# if the usr-is-merged package cannot be installed with apt, do nothing
|
||||||
|
if ! env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
|
||||||
|
echo "no package called usr-is-merged found -- not running merged-usr setup hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "package usr-is-merged found -- running merged-usr setup hook" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# resolve the script path using several methods in order:
|
||||||
|
# 1. using dirname -- "$0"
|
||||||
|
# 2. using ./hooks
|
||||||
|
# 3. using /usr/share/mmdebstrap/hooks/
|
||||||
|
for p in "$(dirname -- "$0")/.." ./hooks /usr/share/mmdebstrap/hooks; do
|
||||||
|
if [ -x "$p/merged-usr/setup00.sh" ] && [ -x "$p/merged-usr/essential00.sh" ]; then
|
||||||
|
"$p/merged-usr/setup00.sh" "$1"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "cannot find merged-usr hook anywhere" >&2
|
||||||
|
exit 1
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET="$1"
|
|
||||||
|
|
||||||
APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install -oDPkg::Chroot-Directory="$TARGET" usr-is-merged
|
|
||||||
|
|
||||||
chroot "$TARGET" dpkg-query --showformat '${db:Status-Status}\n' --show usr-is-merged | grep -q '^installed$'
|
|
||||||
chroot "$TARGET" dpkg-query --showformat '${Source}\n' --show usr-is-merged | grep -q '^usrmerge$'
|
|
||||||
dpkg --compare-versions "1" "lt" "$(chroot "$TARGET" dpkg-query --showformat '${Version}\n' --show usr-is-merged)"
|
|
1
hooks/no-merged-usr/essential00.sh
Symbolic link
1
hooks/no-merged-usr/essential00.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../merged-usr/essential00.sh
|
|
@ -59,7 +59,9 @@ deletecache() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
for f in "$dir/debian-"*.qcow; do
|
for f in "$dir/debian-"*.qcow; do
|
||||||
|
if [ -e "$f" ]; then
|
||||||
rm --one-file-system "$f"
|
rm --one-file-system "$f"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
if [ -e "$dir/debian/pool/main" ]; then
|
if [ -e "$dir/debian/pool/main" ]; then
|
||||||
rm --one-file-system --recursive "$dir/debian/pool/main"
|
rm --one-file-system --recursive "$dir/debian/pool/main"
|
||||||
|
@ -358,16 +360,22 @@ if [ -e "./shared/cache.A" ] && [ -e "./shared/cache.B" ]; then
|
||||||
echo "cache symlink points to $(readlink ./shared/cache)" >&2
|
echo "cache symlink points to $(readlink ./shared/cache)" >&2
|
||||||
case "$(readlink ./shared/cache)" in
|
case "$(readlink ./shared/cache)" in
|
||||||
cache.A)
|
cache.A)
|
||||||
echo "maybe rm -r ./shared/cache.B" >&2
|
echo "removing ./shared/cache.B" >&2
|
||||||
|
rm -r ./shared/cache.B
|
||||||
;;
|
;;
|
||||||
cache.B)
|
cache.B)
|
||||||
echo "maybe rm -r ./shared/cache.A" >&2
|
echo "removing ./shared/cache.A" >&2
|
||||||
|
rm -r ./shared/cache.A
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unexpected" >&2
|
echo "unexpected" >&2
|
||||||
esac
|
|
||||||
fi
|
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "./shared/cache doesn't exist" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "./shared/cache.A" ]; then
|
if [ -e "./shared/cache.A" ]; then
|
||||||
|
@ -409,10 +417,11 @@ mkdir -p "$newcachedir"
|
||||||
touch "$newcachedir/mmdebstrapcache"
|
touch "$newcachedir/mmdebstrapcache"
|
||||||
|
|
||||||
HOSTARCH=$(dpkg --print-architecture)
|
HOSTARCH=$(dpkg --print-architecture)
|
||||||
|
arches="$HOSTARCH"
|
||||||
if [ "$HOSTARCH" = amd64 ]; then
|
if [ "$HOSTARCH" = amd64 ]; then
|
||||||
arches="amd64 arm64 i386"
|
arches="$arches arm64 i386"
|
||||||
else
|
elif [ "$HOSTARCH" = arm64 ]; then
|
||||||
arches="$HOSTARCH"
|
arches="$arches amd64 armhf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for nativearch in $arches; do
|
for nativearch in $arches; do
|
||||||
|
@ -525,6 +534,9 @@ if [ "$HAVE_QEMU" = "yes" ]; then
|
||||||
if [ "$HOSTARCH" = amd64 ] && [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
|
if [ "$HOSTARCH" = amd64 ] && [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
|
||||||
arches=amd64,arm64
|
arches=amd64,arm64
|
||||||
pkgs="$pkgs,libfakechroot:arm64,libfakeroot:arm64"
|
pkgs="$pkgs,libfakechroot:arm64,libfakeroot:arm64"
|
||||||
|
elif [ "$HOSTARCH" = arm64 ] && [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
|
||||||
|
arches=arm64,amd64
|
||||||
|
pkgs="$pkgs,libfakechroot:amd64,libfakeroot:amd64"
|
||||||
else
|
else
|
||||||
arches=$HOSTARCH
|
arches=$HOSTARCH
|
||||||
fi
|
fi
|
||||||
|
@ -582,12 +594,12 @@ handler () {
|
||||||
} 2>&1;
|
} 2>&1;
|
||||||
} | { read xs; exit $xs; };
|
} | { read xs; exit $xs; };
|
||||||
} 3>&1 || ret=$?
|
} 3>&1 || ret=$?
|
||||||
|
echo $ret > /mnt/exitstatus.txt
|
||||||
if [ -e cover_db.img ]; then
|
if [ -e cover_db.img ]; then
|
||||||
df -h cover_db
|
df -h cover_db
|
||||||
umount cover_db
|
umount cover_db
|
||||||
fi
|
fi
|
||||||
echo $ret
|
) > /mnt/output.txt 2>&1
|
||||||
) > /mnt/result.txt 2>&1
|
|
||||||
umount /mnt
|
umount /mnt
|
||||||
systemctl poweroff
|
systemctl poweroff
|
||||||
END
|
END
|
||||||
|
|
80
mmdebstrap
80
mmdebstrap
|
@ -2275,8 +2275,19 @@ sub run_update() {
|
||||||
CHDIR => $options->{root},
|
CHDIR => $options->{root},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Maybe "apt-get update" was already run in the setup hook? If yes, skip
|
||||||
|
# running it here. We are overly strict on purpose because better to run it
|
||||||
|
# twice on accident than not at all.
|
||||||
|
if ( !-d "$options->{root}/var/lib/apt/lists/auxfiles"
|
||||||
|
|| !-d "$options->{root}/var/lib/apt/lists/partial"
|
||||||
|
|| !-e "$options->{root}/var/lib/apt/lists/lock"
|
||||||
|
|| !-e "$options->{root}/var/cache/apt/pkgcache.bin"
|
||||||
|
|| !-e "$options->{root}/var/cache/apt/srcpkgcache.bin") {
|
||||||
info "running apt-get update...";
|
info "running apt-get update...";
|
||||||
run_apt_progress($aptopts);
|
run_apt_progress($aptopts);
|
||||||
|
} else {
|
||||||
|
info "skipping apt-get update because it was already run";
|
||||||
|
}
|
||||||
|
|
||||||
# check if anything was downloaded at all
|
# check if anything was downloaded at all
|
||||||
{
|
{
|
||||||
|
@ -2287,11 +2298,33 @@ sub run_update() {
|
||||||
);
|
);
|
||||||
close $fh;
|
close $fh;
|
||||||
if ($indextargets eq '') {
|
if ($indextargets eq '') {
|
||||||
if ($verbosity_level >= 1) {
|
warning("apt-get indextargets output is empty");
|
||||||
0 == system('apt-cache', 'policy')
|
for my $list (@{ $options->{sourceslists} }) {
|
||||||
or error "apt-cache failed: $?";
|
if (defined $list->{fname}) {
|
||||||
|
info("Filename: $list->{fname}");
|
||||||
}
|
}
|
||||||
error "apt-get update didn't download anything";
|
info("Type: $list->{type}");
|
||||||
|
info("Content:");
|
||||||
|
for my $line (split "\n", $list->{content}) {
|
||||||
|
info(" $line");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open(my $fh, '-|', 'apt-cache', 'policy')
|
||||||
|
// error "failed to fork(): $!";
|
||||||
|
while (my $line = <$fh>) {
|
||||||
|
chomp $line;
|
||||||
|
info $line;
|
||||||
|
}
|
||||||
|
close $fh;
|
||||||
|
my $msg
|
||||||
|
= "apt-get update did not find any indices "
|
||||||
|
. "for architecture '$options->{nativearch}' in ";
|
||||||
|
if (length $options->{suite}) {
|
||||||
|
$msg .= "suite '$options->{suite}'";
|
||||||
|
} else {
|
||||||
|
$msg .= "the configured apt sources";
|
||||||
|
}
|
||||||
|
error $msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4493,14 +4526,28 @@ sub main() {
|
||||||
opendir(my $dh, $opt_value)
|
opendir(my $dh, $opt_value)
|
||||||
or error "Can't opendir($opt_value): $!";
|
or error "Can't opendir($opt_value): $!";
|
||||||
while (my $entry = readdir $dh) {
|
while (my $entry = readdir $dh) {
|
||||||
|
# skip the "." and ".." entries
|
||||||
|
next if $entry eq ".";
|
||||||
|
next if $entry eq "..";
|
||||||
|
my $found = 0;
|
||||||
foreach
|
foreach
|
||||||
my $hook ('setup', 'extract', 'essential', 'customize') {
|
my $hook ('setup', 'extract', 'essential', 'customize') {
|
||||||
if ($entry =~ m/^\Q$hook\E/ and -x "$opt_value/$entry") {
|
if ($entry =~ m/^\Q$hook\E/) {
|
||||||
|
if (-x "$opt_value/$entry") {
|
||||||
push @{ $scripts{$hook} }, "$opt_value/$entry";
|
push @{ $scripts{$hook} }, "$opt_value/$entry";
|
||||||
$count += 1;
|
$count += 1;
|
||||||
|
$found = 1;
|
||||||
|
} else {
|
||||||
|
warning("$opt_value/$entry is named like a "
|
||||||
|
. "hook but not executable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$found && -x "$opt_value/$entry") {
|
||||||
|
warning("$opt_value/$entry: is executable "
|
||||||
|
. "but not prefixed with a hook name");
|
||||||
|
}
|
||||||
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
warning "No executable hook scripts found in $opt_value";
|
warning "No executable hook scripts found in $opt_value";
|
||||||
|
@ -5166,9 +5213,13 @@ sub main() {
|
||||||
$signedby = " [signed-by=\"$keyring\"]";
|
$signedby = " [signed-by=\"$keyring\"]";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
{
|
info "Finding correct signed-by value...";
|
||||||
open(my $fh, '-|', @gpgcmd, '--with-colons', '--show-keys',
|
my $progress = 0.0;
|
||||||
@keyrings) // error "failed to fork(): $!";
|
print_progress($progress);
|
||||||
|
for (my $i = 0 ; $i < scalar @keyrings ; $i++) {
|
||||||
|
my $k = $keyrings[$i];
|
||||||
|
open(my $fh, '-|', @gpgcmd, '--with-colons',
|
||||||
|
'--show-keys', $k) // error "failed to fork(): $!";
|
||||||
while (my $line = <$fh>) {
|
while (my $line = <$fh>) {
|
||||||
if ($line !~ /^fpr:::::::::([^:]+):/) {
|
if ($line !~ /^fpr:::::::::([^:]+):/) {
|
||||||
next;
|
next;
|
||||||
|
@ -5176,10 +5227,12 @@ sub main() {
|
||||||
push @aptfingerprints, $1;
|
push @aptfingerprints, $1;
|
||||||
}
|
}
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
|
||||||
if ($? != 0) {
|
if ($? != 0) {
|
||||||
error "gpg failed";
|
warning("gpg failed to read $k");
|
||||||
}
|
}
|
||||||
|
print_progress($i / (scalar @keyrings) * 100.0, undef);
|
||||||
|
}
|
||||||
|
print_progress("done");
|
||||||
if (scalar @aptfingerprints == 0) {
|
if (scalar @aptfingerprints == 0) {
|
||||||
$signedby = " [signed-by=\"$keyring\"]";
|
$signedby = " [signed-by=\"$keyring\"]";
|
||||||
last;
|
last;
|
||||||
|
@ -6186,7 +6239,12 @@ I<TARGET> is C<-> or if no I<TARGET> was specified.
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
Options are case insensitive. Short options may be bundled. Long options
|
Options are case insensitive. Short options may be bundled. Long options
|
||||||
require a double dash and may be abbreviated to uniqueness.
|
require a double dash and may be abbreviated to uniqueness. Options can be
|
||||||
|
placed anywhere on the command line, even before or mixed with the I<SUITE>,
|
||||||
|
I<TARGET>, and I<MIRROR> arguments. A double dash C<--> can be used to stop
|
||||||
|
interpreting command line arguments as options to allow I<SUITE>, I<TARGET> and
|
||||||
|
I<MIRROR> arguments that start with a single or double dash. Option order only
|
||||||
|
matters for options that can be passed multiple times as documented below.
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ done
|
||||||
cd ./shared;
|
cd ./shared;
|
||||||
$SUDO sh -x ./test.sh;
|
$SUDO sh -x ./test.sh;
|
||||||
echo $?;
|
echo $?;
|
||||||
) 2>&1 | tee shared/result.txt | head --lines=-1
|
) 2>&1 | tee shared/output.txt
|
||||||
if [ "$(tail --lines=1 shared/result.txt)" -ne 0 ]; then
|
if [ "$(cat shared/exitstatus.txt)" -ne 0 ]; then
|
||||||
echo "test.sh failed"
|
echo "test.sh failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
17
run_qemu.sh
17
run_qemu.sh
|
@ -11,10 +11,11 @@ cleanup() {
|
||||||
rm -f "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
rm -f "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
||||||
rm -f "$tmpdir/log"
|
rm -f "$tmpdir/log"
|
||||||
[ -e "$tmpdir" ] && rmdir "$tmpdir"
|
[ -e "$tmpdir" ] && rmdir "$tmpdir"
|
||||||
if [ -e shared/result.txt ]; then
|
if [ -n "${TAIL_PID:-}" ]; then
|
||||||
head --lines=-1 shared/result.txt
|
kill "$TAIL_PID"
|
||||||
res="$(tail --lines=1 shared/result.txt)"
|
fi
|
||||||
rm shared/result.txt
|
if [ -e shared/output.txt ]; then
|
||||||
|
res="$(cat shared/exitstatus.txt)"
|
||||||
if [ "$res" != "0" ]; then
|
if [ "$res" != "0" ]; then
|
||||||
# this might possibly overwrite another non-zero rv
|
# this might possibly overwrite another non-zero rv
|
||||||
rv=1
|
rv=1
|
||||||
|
@ -45,6 +46,14 @@ case $ARCH in
|
||||||
*) echo "qemu kvm not supported on $ARCH" >&2;;
|
*) echo "qemu kvm not supported on $ARCH" >&2;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
echo 1 > shared/exitstatus.txt
|
||||||
|
if [ -e shared/output.txt ]; then
|
||||||
|
rm shared/output.txt
|
||||||
|
fi
|
||||||
|
touch shared/output.txt
|
||||||
|
tail -f shared/output.txt &
|
||||||
|
TAIL_PID=$!
|
||||||
|
|
||||||
# the path to debian-$DEFAULT_DIST.qcow must be absolute or otherwise qemu will
|
# the path to debian-$DEFAULT_DIST.qcow must be absolute or otherwise qemu will
|
||||||
# look for the path relative to debian-$DEFAULT_DIST-overlay.qcow
|
# look for the path relative to debian-$DEFAULT_DIST-overlay.qcow
|
||||||
qemu-img create -f qcow2 -b "$(realpath "$cachedir")/debian-$DEFAULT_DIST.qcow" -F qcow2 "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
qemu-img create -f qcow2 -b "$(realpath "$cachedir")/debian-$DEFAULT_DIST.qcow" -F qcow2 "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
||||||
|
|
|
@ -61,8 +61,15 @@ for f in shadow shadow-; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# isc-dhcp-client postinst doesn't create this file in debootstrap run with
|
||||||
|
# unshared wrapper. The responsible postinst snippet was automatically added
|
||||||
|
# by dh_apparmor since isc-dhcp-client 4.4.3-P1-1.1
|
||||||
|
if [ -e /tmp/debian-debootstrap/etc/apparmor.d/local/sbin.dhclient ] && [ ! -s /tmp/debian-debootstrap/etc/apparmor.d/local/sbin.dhclient ]; then
|
||||||
|
echo /sbin/setcap > /tmp/debian-debootstrap/etc/apparmor.d/local/sbin.dhclient
|
||||||
|
fi
|
||||||
|
|
||||||
# check if the file content differs
|
# check if the file content differs
|
||||||
diff --no-dereference --recursive /tmp/debian-debootstrap /tmp/debian-mm >&2
|
diff --unified --no-dereference --recursive /tmp/debian-debootstrap /tmp/debian-mm >&2
|
||||||
|
|
||||||
# check permissions, ownership, symlink targets, modification times using tar
|
# check permissions, ownership, symlink targets, modification times using tar
|
||||||
# mtimes of directories created by mmdebstrap will differ, thus we equalize them first
|
# mtimes of directories created by mmdebstrap will differ, thus we equalize them first
|
||||||
|
|
|
@ -2,14 +2,10 @@
|
||||||
set -eu
|
set -eu
|
||||||
export LC_ALL=C.UTF-8
|
export LC_ALL=C.UTF-8
|
||||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
if dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpam-runtime)" le 1.5.2-5; then
|
|
||||||
# https://bugs.debian.org/1022952
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM
|
trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM
|
||||||
# we need --hook-dir=./hooks/merged-usr because usrmerge does not understand
|
# we need --hook-dir=./hooks/merged-usr because usrmerge does not understand
|
||||||
# DPKG_ROOT
|
# DPKG_ROOT
|
||||||
for INCLUDE in '' 'systemd-sysv'; do
|
for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do
|
||||||
for MODE in root chrootless; do
|
for MODE in root chrootless; do
|
||||||
{{ CMD }} --mode=$MODE --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
{{ CMD }} --mode=$MODE --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
||||||
${INCLUDE:+--include="$INCLUDE"} \
|
${INCLUDE:+--include="$INCLUDE"} \
|
||||||
|
|
|
@ -16,7 +16,7 @@ prefix=
|
||||||
# DPKG_ROOT
|
# DPKG_ROOT
|
||||||
# permissions drwxr-sr-x and extended attributes of ./var/log/journal/ cannot
|
# permissions drwxr-sr-x and extended attributes of ./var/log/journal/ cannot
|
||||||
# be preserved under fakeroot
|
# be preserved under fakeroot
|
||||||
for INCLUDE in '' 'systemd-sysv'; do
|
for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do
|
||||||
{{ CMD }} --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
{{ CMD }} --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
||||||
--customize-hook='if [ -d "$1"/var/log/journal ]; then rmdir "$1"/var/log/journal; mkdir --mode=2755 "$1"/var/log/journal; chroot "$1" chown root:systemd-journal /var/log/journal; fi' \
|
--customize-hook='if [ -d "$1"/var/log/journal ]; then rmdir "$1"/var/log/journal; mkdir --mode=2755 "$1"/var/log/journal; chroot "$1" chown root:systemd-journal /var/log/journal; fi' \
|
||||||
${INCLUDE:+--include="$INCLUDE"} \
|
${INCLUDE:+--include="$INCLUDE"} \
|
||||||
|
|
|
@ -8,20 +8,42 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
deb2qemu() {
|
||||||
|
case "$1" in
|
||||||
|
amd64) echo x86_64;;
|
||||||
|
arm64) echo aarch64;;
|
||||||
|
armel|armhf) echo arm;;
|
||||||
|
ppc64el) echo ppc64le;;
|
||||||
|
*) echo "$1";;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
||||||
|
arch=amd64
|
||||||
|
else
|
||||||
|
arch=arm64
|
||||||
|
fi
|
||||||
|
|
||||||
[ "$(id -u)" -eq 0 ]
|
[ "$(id -u)" -eq 0 ]
|
||||||
[ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
|
[ -e "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")" ]
|
||||||
|
|
||||||
|
|
||||||
# we need --hook-dir=./hooks/merged-usr because usrmerge does not understand
|
# we need --hook-dir=./hooks/merged-usr because usrmerge does not understand
|
||||||
# DPKG_ROOT
|
# DPKG_ROOT
|
||||||
for INCLUDE in '' 'systemd-sysv'; do
|
#
|
||||||
echo 1 > /proc/sys/fs/binfmt_misc/qemu-aarch64
|
# dpkg is unable to install architecture arch:all packages with a
|
||||||
arch-test arm64
|
# dependency on an arch:any package (perl-modules-5.34 in this case)
|
||||||
{{ CMD }} --mode=root --architecture=arm64 --variant={{ VARIANT }} \
|
# inside foreign architecture chrootless chroots, because dpkg will use
|
||||||
|
# its own architecture as the native architecture, see #825385 and #1020533
|
||||||
|
# So we are not testing the installation of apt,build-essential here.
|
||||||
|
for INCLUDE in '' 'apt' 'systemd-sysv'; do
|
||||||
|
echo 1 > "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")"
|
||||||
|
arch-test "$arch"
|
||||||
|
{{ CMD }} --mode=root --architecture="$arch" --variant={{ VARIANT }} \
|
||||||
--hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \
|
--hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \
|
||||||
{{ DIST }} "/tmp/root.tar" {{ MIRROR }}
|
{{ DIST }} "/tmp/root.tar" {{ MIRROR }}
|
||||||
echo 0 > /proc/sys/fs/binfmt_misc/qemu-aarch64
|
echo 0 > "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")"
|
||||||
arch-test arm64 && exit 1
|
arch-test "$arch" && exit 1
|
||||||
{{ CMD }} --mode=chrootless --architecture=arm64 --variant={{ VARIANT }} \
|
{{ CMD }} --mode=chrootless --architecture="$arch" --variant={{ VARIANT }} \
|
||||||
--hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \
|
--hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \
|
||||||
{{ DIST }} "/tmp/chrootless.tar" {{ MIRROR }}
|
{{ DIST }} "/tmp/chrootless.tar" {{ MIRROR }}
|
||||||
# when creating a foreign architecture chroot, the tarballs are not
|
# when creating a foreign architecture chroot, the tarballs are not
|
||||||
|
|
|
@ -9,7 +9,6 @@ rm -r /tmp/debian-chroot/usr/share/doc/doc-debian
|
||||||
rm /tmp/debian-chroot/usr/share/lintian/overrides/tzdata
|
rm /tmp/debian-chroot/usr/share/lintian/overrides/tzdata
|
||||||
rm /tmp/debian-chroot/etc/localtime
|
rm /tmp/debian-chroot/etc/localtime
|
||||||
rm /tmp/debian-chroot/etc/timezone
|
rm /tmp/debian-chroot/etc/timezone
|
||||||
rm /tmp/debian-chroot/usr/sbin/tzconfig
|
|
||||||
rm -r /tmp/debian-chroot/usr/share/doc/tzdata
|
rm -r /tmp/debian-chroot/usr/share/doc/tzdata
|
||||||
rm -r /tmp/debian-chroot/usr/share/zoneinfo
|
rm -r /tmp/debian-chroot/usr/share/zoneinfo
|
||||||
rm /tmp/debian-chroot/var/lib/apt/extended_states
|
rm /tmp/debian-chroot/var/lib/apt/extended_states
|
||||||
|
|
Loading…
Reference in a new issue