commit: 7ecad37d8747ebb24232ad911433de555124d523
parent 2a0fef17e2ea238924b345d3bcfe5c1d8c3a14be
Author: Dor Askayo <dor.askayo@gmail.com>
Date: Wed, 29 Dec 2021 00:39:01 +0200
Avoid the creation of some dev nodes in chroot mode
In rootless boostrap, dev nodes must be mounted before starting the
bootstrap process. However, some of these aren't necessarily mounted,
such as when relying upon BuildStream's sandbox.
Since these are not actually required for either a rootless or
chroot-based bootstrap, simply avoid them.
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/sysc/run.sh b/sysc/run.sh
@@ -10,6 +10,8 @@ set -e
# shellcheck source=sysglobal/helpers.sh
. helpers.sh
+# shellcheck source=/dev/null
+. bootstrap.cfg
export PATH=/usr/bin:/usr/sbin
export PREFIX=/usr
diff --git a/sysglobal/helpers.sh b/sysglobal/helpers.sh
@@ -172,9 +172,12 @@ populate_device_nodes() {
mkdir -p "${1}/dev"
test -c "${1}/dev/null" || mknod -m 666 "${1}/dev/null" c 1 3
test -c "${1}/dev/zero" || mknod -m 666 "${1}/dev/zero" c 1 5
- test -c "${1}/dev/ptmx" || mknod -m 666 "${1}/dev/ptmx" c 5 2
- test -c "${1}/dev/tty" || mknod -m 666 "${1}/dev/tty" c 5 0
test -c "${1}/dev/random" || mknod -m 444 "${1}/dev/random" c 1 8
test -c "${1}/dev/urandom" || mknod -m 444 "${1}/dev/urandom" c 1 9
- test -c "${1}/dev/console" || mknod -m 666 "${1}/dev/console" c 5 1
+
+ if [ "${CHROOT}" = False ]; then
+ test -c "${1}/dev/ptmx" || mknod -m 666 "${1}/dev/ptmx" c 5 2
+ test -c "${1}/dev/tty" || mknod -m 666 "${1}/dev/tty" c 5 0
+ test -c "${1}/dev/console" || mknod -m 666 "${1}/dev/console" c 5 1
+ fi
}