summaryrefslogtreecommitdiffstats
path: root/debian/tests/fake/schroot-1.6.10-3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:37:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:37:38 +0000
commit53d04d9ab57185eef71a52b9cd8b8acb182c8d25 (patch)
treefd3dfc39ef170fb257c8971f0c22f4f771096676 /debian/tests/fake/schroot-1.6.10-3
parentAdding upstream version 1.0.114+deb10u1. (diff)
downloaddebootstrap-53d04d9ab57185eef71a52b9cd8b8acb182c8d25.tar.xz
debootstrap-53d04d9ab57185eef71a52b9cd8b8acb182c8d25.zip
Adding debian version 1.0.114+deb10u1.debian/1.0.114+deb10u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/fake/schroot-1.6.10-3')
-rwxr-xr-xdebian/tests/fake/schroot-1.6.10-347
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/tests/fake/schroot-1.6.10-3 b/debian/tests/fake/schroot-1.6.10-3
new file mode 100755
index 0000000..d6e0bbe
--- /dev/null
+++ b/debian/tests/fake/schroot-1.6.10-3
@@ -0,0 +1,47 @@
+#!/bin/sh
+# fake/schroot-1.6.10-3 -- emulate how schroot/1.6.10-3 would chroot.
+# It bind-mounts /dev/pts and maybe /dev from the host system.
+# (There is of course a lot more that it does, but these are the parts that
+# affect pty users like script(1).)
+#
+# Copyright © 2017 Simon McVittie
+# SPDX-License-Identifier: MIT
+# (see debian/copyright)
+
+set -e
+
+# /etc/schroot/default/fstab
+bind_dev=yes
+
+while true; do
+ case "$1" in
+ (--sbuild)
+ shift
+ # /etc/schroot/sbuild/fstab
+ bind_dev=no
+ ;;
+ (*)
+ break
+ esac
+done
+
+chroot="$1"
+shift
+if test -z "$chroot" || test -z "$1"; then
+ echo "Usage: $0 CHROOT COMMAND...">&2
+ exit 2
+fi
+
+[ "$bind_dev" = no ] || mount --bind /dev "$chroot/dev"
+mount --bind /dev/pts "$chroot/dev/pts"
+
+ls -l "$chroot/dev/ptmx" | sed -e 's/^/# fake-schroot: /' >&2
+ls -l "$chroot/dev/pts/ptmx" | sed -e 's/^/# fake-schroot: /' >&2
+
+e=0
+chroot "$chroot" "$@" || e=$?
+
+umount "$chroot/dev/pts"
+[ "$bind_dev" = no ] || umount "$chroot/dev"
+
+exit "$e"