Compare commits
5 commits
736cb493ea
...
9cc494f245
Author | SHA1 | Date | |
---|---|---|---|
9cc494f245 | |||
6d220e9a8d | |||
5ea299f3d2 | |||
fb1e5c32e6 | |||
104fba0256 |
8 changed files with 104 additions and 36 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
1.3.1 (2023-01-20)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- bugfix release
|
||||||
|
|
||||||
1.3.0 (2023-01-16)
|
1.3.0 (2023-01-16)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,24 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# if dpkg is new enough, do nothing
|
# we need to check the version of dpkg
|
||||||
# we cannot ask dpkg-query about the version because dpkg is only extracted
|
# since at this point packages are just extracted but not installed, we cannot use dpkg-query
|
||||||
# but not installed at this point
|
# since we want to support chrootless, we cannot run dpkg --version inside the chroot
|
||||||
dpkg_ver="$(chroot "$1" dpkg --version | grep --extended-regexp --only-matching '[0-9]+\.[0-9.]+')"
|
# to avoid this hook depending on dpkg-dev being installed, we do not parse the extracted changelog with dpkg-parsechangelog
|
||||||
if dpkg --compare-versions "$dpkg_ver" ge 1.17.11; then
|
# we also want to avoid parsing the changelog because /usr/share/doc might've been added to dpkg --path-exclude
|
||||||
echo "dpkg version $dpkg_ver is >= 1.17.11 -- not running jessie-or-older extract00 hook" >&2
|
# instead, we just ask apt about the latest version of dpkg it knows of
|
||||||
|
# this should only fail in situations where there are multiple versions of dpkg in different suites
|
||||||
|
ver=$(env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions dpkg 2>/dev/null | sed -ne 's/^Version: \(.*\)$/\1/p' || printf '')
|
||||||
|
if [ -z "$ver" ]; then
|
||||||
|
echo "no package called dpkg can be installed -- not running jessie-or-older extract00 hook" >&2
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if dpkg --compare-versions "$ver" ge 1.17.11; then
|
||||||
|
echo "dpkg version $ver is >= 1.17.11 -- not running jessie-or-older extract00 hook" >&2
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "dpkg version $dpkg_ver is << 1.17.11 -- running jessie-or-older extract00 hook" >&2
|
echo "dpkg version $ver is << 1.17.11 -- running jessie-or-older extract00 hook" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# resolve the script path using several methods in order:
|
# resolve the script path using several methods in order:
|
||||||
|
|
|
@ -2,18 +2,44 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# If the init package has not been extracted, then it is not part of the
|
# The jessie-or-older extract01 hook has to be run up to the point where the
|
||||||
# Essential:yes set and we do not need this workaround. This holds true for the
|
# Essential:yes field was removed from the init package (with
|
||||||
# init package version 1.34 and later. Instead of asking apt about the init
|
# init-system-helpers 1.34). Since the essential packages have only been
|
||||||
# version (which might not be the same version that was picked to be installed)
|
# extracted but not installed, we cannot use dpkg-query to find out its
|
||||||
# we check for the presence of the init package by checking whether
|
# version. Since /usr/share/doc might be missing due to dpkg --path-exclude, we
|
||||||
# /usr/share/doc/init/copyright exists.
|
# also cannot check whether /usr/share/doc/init/copyright exists. There also
|
||||||
|
# was a time (before init-system-helpers 1.20) where there was no init package
|
||||||
if [ -e "$1/usr/share/doc/init/copyright" ]; then
|
# at all where we also want to apply this hook. So we just ask apt about the
|
||||||
echo "the init package is not Essential:yes -- not running jessie-or-older extract01 hook" >&2
|
# candidate version for init-system-helpers. This should only fail in
|
||||||
|
# situations where there are multiple versions of init-system-helpers in
|
||||||
|
# different suites.
|
||||||
|
ver=$(env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions init-system-helpers 2>/dev/null | sed -ne 's/^Version: \(.*\)$/\1/p' || printf '')
|
||||||
|
if [ -z "$ver" ]; then
|
||||||
|
# there is no package called init-system-helpers, so either:
|
||||||
|
# - this is so old that init-system-helpers didn't exist yet
|
||||||
|
# - we are in a future where init-system-helpers doesn't exist anymore
|
||||||
|
# - something strange is going on
|
||||||
|
# we should only call the hook in the first case
|
||||||
|
ver=$(env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions base-files 2>/dev/null | sed -ne 's/^Version: \(.*\)$/\1/p' || printf '')
|
||||||
|
if [ -z "$ver" ]; then
|
||||||
|
echo "neither init-system-helpers nor base-files can be installed -- not running jessie-or-older extract01 hook" >&2
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Jessie is Debian 8
|
||||||
|
if dpkg --compare-versions "$ver" ge 8; then
|
||||||
|
echo "there is no init-system-helpers but base-files version $ver is >= 8 -- not running jessie-or-older extract01 hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "there is no init-system-helpers but base-files version $ver is << 8 -- running jessie-or-older extract01 hook" >&2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "the init package is Essential:yes -- running jessie-or-older extract01 hook" >&2
|
if dpkg --compare-versions "$ver" ge 1.34; then
|
||||||
|
echo "init-system-helpers version $ver is >= 1.34 -- not running jessie-or-older extract01 hook" >&2
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "init-system-helpers version $ver is << 1.34 -- running jessie-or-older extract01 hook" >&2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# resolve the script path using several methods in order:
|
# resolve the script path using several methods in order:
|
||||||
|
|
|
@ -2,13 +2,24 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# if the usr-is-merged package cannot be installed with apt, do nothing
|
ver=$(dpkg-query --root="$1" -f '${db:Status-Status} ${Source} ${Version}' --show usr-is-merged 2>/dev/null || printf '')
|
||||||
if ! env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
|
case "$ver" in
|
||||||
echo "no package called usr-is-merged found -- not running merged-usr essential hook" >&2
|
'')
|
||||||
|
echo "no package called usr-is-merged is installed -- not running merged-usr essential hook" >&2
|
||||||
exit 0
|
exit 0
|
||||||
else
|
;;
|
||||||
echo "package usr-is-merged found -- running merged-usr essential hook" >&2
|
'installed mmdebstrap-dummy-usr-is-merged 1')
|
||||||
fi
|
echo "dummy usr-is-merged package installed -- running merged-usr essential hook" >&2
|
||||||
|
;;
|
||||||
|
'installed usrmerge '*)
|
||||||
|
echo "usr-is-merged package from src:usrmerge installed -- not running merged-usr essential hook" >&2
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unexpected situation for package usr-is-merged: $ver" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# resolve the script path using several methods in order:
|
# resolve the script path using several methods in order:
|
||||||
# 1. using dirname -- "$0"
|
# 1. using dirname -- "$0"
|
||||||
|
|
11
mmdebstrap
11
mmdebstrap
|
@ -23,7 +23,7 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
our $VERSION = '1.3.0';
|
our $VERSION = '1.3.1';
|
||||||
|
|
||||||
use English;
|
use English;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
@ -6704,7 +6704,14 @@ C<Essential:yes> packages.
|
||||||
|
|
||||||
=item B<apt>
|
=item B<apt>
|
||||||
|
|
||||||
The B<essential> set plus apt.
|
The B<essential> set plus apt. This variant uses the fact that B<apt> treats
|
||||||
|
itself as essential and thus running C<apt-get dist-upgrade> without any
|
||||||
|
packages installed will install the B<essential> set plus B<apt>. If you just
|
||||||
|
want B<essential> and B<apt>, then this variant is faster than using the
|
||||||
|
B<essential> variant and adding B<apt> via C<--include> because all packages
|
||||||
|
get installed at once. The downside of this variant is, that if it should
|
||||||
|
happen that an B<essential> package is not installable, then it will just get
|
||||||
|
ignored without throwing an error.
|
||||||
|
|
||||||
=item B<required>, B<minbase>
|
=item B<required>, B<minbase>
|
||||||
|
|
||||||
|
|
26
run_null.sh
26
run_null.sh
|
@ -17,14 +17,24 @@ while [ "$#" -gt 0 ]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
# subshell so that we can cd without effecting the rest
|
# - Run command with fds 3 and 4 closed so that whatever test.sh does it
|
||||||
(
|
# cannot interfere with these.
|
||||||
set +e
|
# - Both stdin and stderr of test.sh are written to stdout
|
||||||
cd ./shared;
|
# - Write exit status of test.sh to fd 3
|
||||||
$SUDO sh -x ./test.sh;
|
# - Write stdout to shared/output.txt as well as to fd 4
|
||||||
echo $?;
|
# - Redirect fd 3 to stdout
|
||||||
) 2>&1 | tee shared/output.txt
|
# - Read fd 3 and let the group exit with that value
|
||||||
if [ "$(cat shared/exitstatus.txt)" -ne 0 ]; then
|
# - Redirect fd 4 to stdout
|
||||||
|
ret=0
|
||||||
|
{ { { {
|
||||||
|
ret=0;
|
||||||
|
( exec 3>&- 4>&-; env --chdir=./shared $SUDO sh -x ./test.sh 2>&1) || ret=$?;
|
||||||
|
echo $ret >&3;
|
||||||
|
} | tee shared/output.txt >&4;
|
||||||
|
} 3>&1;
|
||||||
|
} | { read -r xs; exit "$xs"; }
|
||||||
|
} 4>&1 || ret=$?
|
||||||
|
if [ "$ret" -ne 0 ]; then
|
||||||
echo "test.sh failed"
|
echo "test.sh failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -116,7 +116,7 @@ END
|
||||||
|
|
||||||
# use script to create a fake tty
|
# use script to create a fake tty
|
||||||
# run all tests as root and as a normal user (the latter requires ptmxmode=666)
|
# run all tests as root and as a normal user (the latter requires ptmxmode=666)
|
||||||
script -qfc "$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \
|
script -qfec "$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \
|
||||||
--include=gcc,libc6-dev,python3,adduser \
|
--include=gcc,libc6-dev,python3,adduser \
|
||||||
--customize-hook='chroot \"\$1\" adduser --gecos user --disabled-password user' \
|
--customize-hook='chroot \"\$1\" adduser --gecos user --disabled-password user' \
|
||||||
--customize-hook='chroot \"\$1\" python3 -c \"import pty; print(pty.openpty())\"' \
|
--customize-hook='chroot \"\$1\" python3 -c \"import pty; print(pty.openpty())\"' \
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
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
|
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 -qfec "{{ 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 -
|
||||||
|
|
Loading…
Reference in a new issue