From ee17e45964b786b48b455959dfe68715971893fb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 16:14:39 +0200 Subject: Adding upstream version 1.4.3. Signed-off-by: Daniel Baumann --- tests/include-deb-file | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/include-deb-file (limited to 'tests/include-deb-file') diff --git a/tests/include-deb-file b/tests/include-deb-file new file mode 100644 index 0000000..ad31de2 --- /dev/null +++ b/tests/include-deb-file @@ -0,0 +1,40 @@ +#!/bin/sh + +set -eu +export LC_ALL=C.UTF-8 + +trap "rm -rf /tmp/dummypkg.deb /tmp/dummypkg" EXIT INT TERM + +prefix= +if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && [ "{{ MODE }}" != "auto" ]; then + if ! id "${SUDO_USER:-user}" >/dev/null 2>&1; then + if [ ! -e /mmdebstrap-testenv ]; then + echo "this test modifies the system and should only be run inside a container" >&2 + exit 1 + fi + useradd --home-dir "/home/${SUDO_USER:-user}" --create-home "${SUDO_USER:-user}" + fi + prefix="runuser -u ${SUDO_USER:-user} --" +fi + +# instead of obtaining a .deb from our cache, we create a new package because +# otherwise apt might decide to download the package with the same name and +# version from the cache instead of using the local .deb +mkdir -p /tmp/dummypkg/DEBIAN +cat << END > "/tmp/dummypkg/DEBIAN/control" +Package: dummypkg +Priority: optional +Section: oldlibs +Maintainer: Johannes Schauer Marin Rodrigues +Architecture: all +Multi-Arch: foreign +Source: dummypkg +Version: 1 +Description: dummypkg +END +dpkg-deb --build "/tmp/dummypkg" "/tmp/dummypkg.deb" + +$prefix {{ CMD }} --mode={{ MODE }} --variant=apt --include="/tmp/dummypkg.deb" \ + --hook-dir=./hooks/file-mirror-automount \ + --customize-hook='chroot "$1" dpkg-query -W -f="\${Status}\n" dummypkg | grep "^install ok installed$"' \ + {{ DIST }} /dev/null {{ MIRROR }} -- cgit v1.2.3