elements: Respect devpts mount options

This is a continuation for f2cc647dae ("diskimage_builder: lib:
common-functions: Fix options for devpts mount"). We also need to
respect the devpts mount options when the dib elements are mounting
this virtual filesystems themselves.

Change-Id: Iee44703297a15b14c715f4bfb7bae67f613aceee
This commit is contained in:
Markos Chandras 2017-11-09 17:40:57 +02:00
parent b5b9d98fa0
commit da02f37de1
3 changed files with 20 additions and 2 deletions

View File

@ -223,7 +223,13 @@ function _install_pkg_manager {
sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
sudo mount -t proc none $TARGET_ROOT/proc sudo mount -t proc none $TARGET_ROOT/proc
sudo mount --bind /dev $TARGET_ROOT/dev sudo mount --bind /dev $TARGET_ROOT/dev
sudo mount -t devpts /dev/pts $TARGET_ROOT/dev/pts # Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6
# introduced in v4.7 allows multiple instances of devpts. However,
# some distributions are running older kernels so we need to take
# care on what options we use to mount a new instance of devpts
# filesystem since it's not completely independent. The best thing
# to do is to simply use the existing mount options.
sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts
sudo mount -t sysfs none $TARGET_ROOT/sys sudo mount -t sysfs none $TARGET_ROOT/sys
# initalize rpmdb # initalize rpmdb

View File

@ -87,7 +87,13 @@ sudo zypper ${ZYPPER_TARGET_OPTS} refresh
sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
sudo mount -t proc none $TARGET_ROOT/proc sudo mount -t proc none $TARGET_ROOT/proc
sudo mount --bind /dev $TARGET_ROOT/dev sudo mount --bind /dev $TARGET_ROOT/dev
sudo mount -t devpts /dev/pts $TARGET_ROOT/dev/pts # Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6
# introduced in v4.7 allows multiple instances of devpts. However,
# some distributions are running older kernels so we need to take
# care on what options we use to mount a new instance of devpts
# filesystem since it's not completely independent. The best thing
# to do is to simply use the existing mount options.
sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts
sudo mount -t sysfs none $TARGET_ROOT/sys sudo mount -t sysfs none $TARGET_ROOT/sys
# Install filesystem, base and useful tools # Install filesystem, base and useful tools

View File

@ -316,6 +316,12 @@ function mount_proc_dev_sys () {
# supporting kernel file systems # supporting kernel file systems
sudo mount -t proc none $TMP_MOUNT_PATH/proc sudo mount -t proc none $TMP_MOUNT_PATH/proc
sudo mount --bind /dev $TMP_MOUNT_PATH/dev sudo mount --bind /dev $TMP_MOUNT_PATH/dev
# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6
# introduced in v4.7 allows multiple instances of devpts. However,
# some distributions are running older kernels so we need to take
# care on what options we use to mount a new instance of devpts
# filesystem since it's not completely independent. The best thing
# to do is to simply use the existing mount options.
sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TMP_MOUNT_PATH/dev/pts sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TMP_MOUNT_PATH/dev/pts
sudo mount -t sysfs none $TMP_MOUNT_PATH/sys sudo mount -t sysfs none $TMP_MOUNT_PATH/sys
} }