summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-12-01 02:01:46 +0000
committerGerrit Code Review <review@openstack.org>2017-12-01 02:01:46 +0000
commit6ab9655ca341953ac85c045c9c8ec2d4c4b771db (patch)
tree7b18e121f32aaefd50a748a62dd9c8ac1307ca77
parentc247cb41bbc3d5f06d55746ad2391058f3eb8938 (diff)
parent46a07de4800ad665502fe61bf4e9fb85c804febe (diff)
Merge "Fix /dev/pts mount options handling"
-rwxr-xr-xdiskimage_builder/elements/yum-minimal/root.d/08-yum-chroot10
-rwxr-xr-xdiskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot10
-rw-r--r--diskimage_builder/lib/common-functions19
3 files changed, 18 insertions, 21 deletions
diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot
index 055377c..67f9fa9 100755
--- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot
+++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot
@@ -23,6 +23,8 @@ fi
23set -eu 23set -eu
24set -o pipefail 24set -o pipefail
25 25
26source $_LIB/common-functions
27
26if [ -f ${TARGET_ROOT}/.extra_settings ] ; then 28if [ -f ${TARGET_ROOT}/.extra_settings ] ; then
27 . ${TARGET_ROOT}/.extra_settings 29 . ${TARGET_ROOT}/.extra_settings
28fi 30fi
@@ -228,13 +230,7 @@ function _install_pkg_manager {
228sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys 230sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
229sudo mount -t proc none $TARGET_ROOT/proc 231sudo mount -t proc none $TARGET_ROOT/proc
230sudo mount --bind /dev $TARGET_ROOT/dev 232sudo mount --bind /dev $TARGET_ROOT/dev
231# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 233sudo mount -t devpts $(mount_dev_pts_options) devpts $TARGET_ROOT/dev/pts
232# introduced in v4.7 allows multiple instances of devpts. However,
233# some distributions are running older kernels so we need to take
234# care on what options we use to mount a new instance of devpts
235# filesystem since it's not completely independent. The best thing
236# to do is to simply use the existing mount options.
237sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts
238sudo mount -t sysfs none $TARGET_ROOT/sys 234sudo mount -t sysfs none $TARGET_ROOT/sys
239 235
240# initalize rpmdb 236# initalize rpmdb
diff --git a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot
index a159070..3cdba16 100755
--- a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot
+++ b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot
@@ -24,6 +24,8 @@ fi
24set -eu 24set -eu
25set -o pipefail 25set -o pipefail
26 26
27source $_LIB/common-functions
28
27function cleanup() { 29function cleanup() {
28 sudo umount $TARGET_ROOT/proc 30 sudo umount $TARGET_ROOT/proc
29 sudo umount $TARGET_ROOT/dev/pts 31 sudo umount $TARGET_ROOT/dev/pts
@@ -91,13 +93,7 @@ sudo zypper ${ZYPPER_TARGET_OPTS} refresh
91sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys 93sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
92sudo mount -t proc none $TARGET_ROOT/proc 94sudo mount -t proc none $TARGET_ROOT/proc
93sudo mount --bind /dev $TARGET_ROOT/dev 95sudo mount --bind /dev $TARGET_ROOT/dev
94# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 96sudo mount -t devpts $(mount_dev_pts_options) devpts $TARGET_ROOT/dev/pts
95# introduced in v4.7 allows multiple instances of devpts. However,
96# some distributions are running older kernels so we need to take
97# care on what options we use to mount a new instance of devpts
98# filesystem since it's not completely independent. The best thing
99# to do is to simply use the existing mount options.
100sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TARGET_ROOT/dev/pts
101sudo mount -t sysfs none $TARGET_ROOT/sys 97sudo mount -t sysfs none $TARGET_ROOT/sys
102 98
103# Install filesystem, base and useful tools 99# Install filesystem, base and useful tools
diff --git a/diskimage_builder/lib/common-functions b/diskimage_builder/lib/common-functions
index 981e9c7..2244de8 100644
--- a/diskimage_builder/lib/common-functions
+++ b/diskimage_builder/lib/common-functions
@@ -312,17 +312,22 @@ function create_base () {
312 mount_proc_dev_sys 312 mount_proc_dev_sys
313} 313}
314 314
315# Get mount options for mounting /dev/pts
316# Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6
317# introduced in v4.7 allows multiple instances of devpts. However,
318# some distributions are running older kernels so we need to take
319# care on what options we use to mount a new instance of devpts
320# filesystem since it's not completely independent. The best thing
321# to do is to simply use the existing mount options.
322function mount_dev_pts_options() {
323 echo "-o $(findmnt --first-only /dev/pts --noheadings --output OPTIONS)"
324}
325
315function mount_proc_dev_sys () { 326function mount_proc_dev_sys () {
316 # supporting kernel file systems 327 # supporting kernel file systems
317 sudo mount -t proc none $TMP_MOUNT_PATH/proc 328 sudo mount -t proc none $TMP_MOUNT_PATH/proc
318 sudo mount --bind /dev $TMP_MOUNT_PATH/dev 329 sudo mount --bind /dev $TMP_MOUNT_PATH/dev
319 # Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 330 sudo mount -t devpts $(mount_dev_pts_options) devpts $TMP_MOUNT_PATH/dev/pts
320 # introduced in v4.7 allows multiple instances of devpts. However,
321 # some distributions are running older kernels so we need to take
322 # care on what options we use to mount a new instance of devpts
323 # filesystem since it's not completely independent. The best thing
324 # to do is to simply use the existing mount options.
325 sudo mount -t devpts -o $(mount | grep devpts | sed 's/.*(\(.*\))/\1/') devpts $TMP_MOUNT_PATH/dev/pts
326 sudo mount -t sysfs none $TMP_MOUNT_PATH/sys 331 sudo mount -t sysfs none $TMP_MOUNT_PATH/sys
327} 332}
328 333