diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:04:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:04:12 +0000 |
commit | 184e81741dd97773953241571cd059e5cadea9aa (patch) | |
tree | d3990b8bc6d54cb2e0dd625fedb39219fa883149 /mmdebstrap-autopkgtest-build-qemu | |
parent | Adding debian version 1.4.3-6. (diff) | |
download | mmdebstrap-184e81741dd97773953241571cd059e5cadea9aa.tar.xz mmdebstrap-184e81741dd97773953241571cd059e5cadea9aa.zip |
Merging upstream version 1.5.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mmdebstrap-autopkgtest-build-qemu')
-rwxr-xr-x | mmdebstrap-autopkgtest-build-qemu | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/mmdebstrap-autopkgtest-build-qemu b/mmdebstrap-autopkgtest-build-qemu index 19175e5..2d1b803 100755 --- a/mmdebstrap-autopkgtest-build-qemu +++ b/mmdebstrap-autopkgtest-build-qemu @@ -261,9 +261,21 @@ case "$ARCHITECTURE" in ;; esac +test_installed() { + pkg="$1" + if [ "$(dpkg-query -f '${db:Status-Status}' -W "$pkg")" != installed ]; then + die "please install $pkg" + fi +} + +for pkg in autopkgtest dosfstools e2fsprogs fdisk mount mtools passwd uidmap; do + test_installed "$pkg" +done + if test "$(dpkg-query -f '${db:Status-Status}' -W binutils-multiarch)" = installed; then GNU_PREFIX= else + test_installed dpkg-dev GNU_ARCHITECTURE="$(dpkg-architecture "-a$ARCHITECTURE" -qDEB_HOST_GNU_TYPE)" GNU_PREFIX="$GNU_ARCHITECTURE-" GNU_SUFFIX="-$(echo "$GNU_ARCHITECTURE" | tr _ -)" @@ -277,11 +289,7 @@ case $arches in *) die "enable $ARCHITECTURE by running: sudo dpkg --add-architecture $ARCHITECTURE && sudo apt update" ;; esac -for pkg in autopkgtest dosfstools e2fsprogs fdisk mount mtools passwd "systemd-boot-efi:$ARCHITECTURE" uidmap; do - if [ "$(dpkg-query -f '${db:Status-Status}' -W "$pkg")" != installed ]; then - die "please install $pkg" - fi -done +test_installed "systemd-boot-efi:$ARCHITECTURE" BOOTSTUB="/usr/lib/systemd/boot/efi/linux${EFIIMG#boot}.stub" @@ -308,12 +316,15 @@ FAT_SIZE_SECTORS=$((1024*254)) # - users who prefer qcow2 get to choose to run it themselves with their own # custom options like compression # +# --map-users=auto --map-user=0 => 0:$UID:1 + 1:$SUBUIDBASE:65535 +# --map-users=auto --map-user=65536 => 0:$SUBUIDBASE:65536 + 65536:$UID:1 +# # Make the image writeable to the first subgid. mmdebstrap will map this gid to # the root group. unshare instead will map the current gid to 0 and the first # subgid to 1. Therefore mmdebstrap will be able to write to the image. rm -f "$IMAGE" : >"$IMAGE" -unshare -U -r --map-groups=auto chown 0:1 "$IMAGE" +unshare --map-user=0 --map-group=0 --map-groups=auto chown 0:1 "$IMAGE" chmod 0660 "$IMAGE" # Make sure that the unshared user is able to access the file. @@ -350,13 +361,17 @@ fi EXT4_OFFSET_BYTES=$(( (FAT_OFFSET_SECTORS + FAT_SIZE_SECTORS) * 512)) EXT4_OPTIONS="offset=$EXT4_OFFSET_BYTES,assume_storage_prezeroed=1" + +# the --no-mtab option to mount is a workaround for https://github.com/util-linux/util-linux/issues/2981 +# revert 8c0ddc32660ca4e98c988966251f9c05d6bcccef once it is no longer needed set -- "$@" \ "--customize-hook=download vmlinuz '$WORKDIR/kernel'" \ "--customize-hook=download initrd.img '$WORKDIR/initrd'" \ - '--customize-hook=mount --bind "$1" "$1/mnt"' \ - '--customize-hook=mount --bind "$1/mnt/mnt" "$1/mnt/dev"' \ + '--customize-hook=mount --no-mtab --bind "$1" "$1/mnt"' \ + '--customize-hook=mount --no-mtab --bind "$1/mnt/mnt" "$1/mnt/dev"' \ '--customize-hook=/sbin/mkfs.ext4 -d "$1/mnt" -L autopkgtestvm -E '"'$EXT4_OPTIONS' '$IMAGE' '$SIZE'" \ - '--customize-hook=umount --lazy "$1/mnt"' \ + '--customize-hook=umount --lazy --no-mtab "$1/mnt/dev"' \ + '--customize-hook=umount --lazy --no-mtab "$1/mnt"' \ "$RELEASE" \ /dev/null |