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.
This commit is contained in:
Dor Askayo 2021-12-29 00:39:01 +02:00
parent 2a0fef17e2
commit 7ecad37d87
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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
}