From c23727e1367ec467ef30822e9c4e4da4278019f3 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Wed, 27 Sep 2023 07:56:49 +0200 Subject: [PATCH] export container=mmdebstrap-unshare environment variable in unshare-mode hooks --- mmdebstrap | 5 ++++- tests/as-debootstrap-unshare-wrapper | 9 +-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index e703850..ddff3d3 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1654,6 +1654,9 @@ sub run_hooks { push @env_opts, ("MMDEBSTRAP_ESSENTIAL=" . (join " ", @{$essential_pkgs})); } + if ($options->{mode} eq 'unshare') { + push @env_opts, "container=mmdebstrap-unshare"; + } # Unset the close-on-exec flag, so that the file descriptor does not # get closed when we exec @@ -7412,7 +7415,7 @@ As a debootstrap wrapper to run it without superuser privileges but using Linux user namespaces instead. This fixes Debian bug #829134. $ mmdebstrap --variant=custom --mode=unshare \ - --setup-hook='env container=lxc debootstrap unstable "$1"' \ + --setup-hook='debootstrap unstable "$1"' \ - debian-debootstrap.tar Build a non-Debian chroot like Ubuntu bionic: diff --git a/tests/as-debootstrap-unshare-wrapper b/tests/as-debootstrap-unshare-wrapper index 47c6d62..b3f7a44 100644 --- a/tests/as-debootstrap-unshare-wrapper +++ b/tests/as-debootstrap-unshare-wrapper @@ -35,15 +35,8 @@ if [ -n "$AUTOPROXY" ] && [ -x "$AUTOPROXY" ] && [ -e /tmp/.auto-apt-proxy-0 ]; chmod 644 "$TMP_APT_CONFIG" fi -# debootstrap runs mount -t proc proc /proc which doesn't work in an unshared -# namespace on privileged docker (like salsaci), so mount /proc manually -# https://bugs.debian.org/1031222 -# https://salsa.debian.org/installer-team/debootstrap/-/merge_requests/91 $prefix {{ CMD }} --variant=custom --mode={{ MODE }} \ - --setup-hook='env '"${AUTOPROXY:+APT_CONFIG='$TMP_APT_CONFIG'}"' container=lxc debootstrap --variant={{ VARIANT }} unstable "$1" {{ MIRROR }}' \ - --setup-hook='mount -o rbind /proc "$1/proc"' \ - --setup-hook='chroot "$1" dpkg-reconfigure systemd || true' \ - --setup-hook='umount --lazy "$1/proc"' \ + --setup-hook='env '"${AUTOPROXY:+APT_CONFIG='$TMP_APT_CONFIG'}"' debootstrap --variant={{ VARIANT }} unstable "$1" {{ MIRROR }}' \ - /tmp/debian-mm.tar {{ MIRROR }} if [ -n "$AUTOPROXY" ] && [ -x "$AUTOPROXY" ] && [ -e /tmp/.auto-apt-proxy-0 ]; then rm "$TMP_APT_CONFIG"