blob: 308ed3414ab218d7393191eb6e8b6002620d42d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
# fake/pbuilder-0.228.4-1 -- emulate how pbuilder/0.228.4-1 would chroot.
# It mounts /dev/pts, without explicitly requesting a new instance or a
# usable /dev/pts/ptmx.
# (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
chroot="$1"
shift
if test -z "$chroot" || test -z "$1"; then
echo "Usage: $0 CHROOT COMMAND...">&2
exit 2
fi
mkdir -p "$chroot/dev/pts"
mount -t devpts none "$chroot/dev/pts" -onoexec,nosuid,gid=5,mode=620
ls -l "$chroot/dev/ptmx" | sed -e 's/^/# fake-pbuilder: /' >&2
ls -l "$chroot/dev/pts/ptmx" | sed -e 's/^/# fake-pbuilder: /' >&2
e=0
chroot "$chroot" "$@" || e=$?
umount "$chroot/dev/pts"
exit "$e"
|