From 7ecad37d8747ebb24232ad911433de555124d523 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Wed, 29 Dec 2021 00:39:01 +0200 Subject: [PATCH] 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. --- sysc/run.sh | 2 ++ sysglobal/helpers.sh | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sysc/run.sh b/sysc/run.sh index 074d648..dedf40b 100755 --- 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 index e4f2e32..de72a9e 100755 --- 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 }