mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
enter_chroot: when preparing chroot, mount devpts filesystem as well
* This also adds reverse sort into the umount list, because of cascading mounts, so that /foo/anything is always before /foo, and as such is always unmounted first. If the list were not sorted, "mount point busy" errors might occur, depending on various conditions. TEST= 1) With a previously created chroot, I ran enter_chroot.sh, and got the correct prompt. After logging out of that prompt, everything else was correctly unmounted, without any error messages. When entering chroot twice from two different shells, everything was correctly unmounted after the last shell exited. 2) Repeat 1 but with cleanly created chroot just for this purpose. 3) In the chroot, make packages for one board (x86-generic) using build_packages 4) The messages "openpty failed: 'out of pty devices'" whenever trying to emerge anything (or other commands looking up pts) have disappeared. Review URL: http://codereview.chromium.org/2714010
This commit is contained in:
parent
587d7498a1
commit
6f17b5e5fe
@ -104,6 +104,13 @@ function setup_env {
|
||||
die "Could not mount $MOUNTED_PATH"
|
||||
fi
|
||||
|
||||
MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/dev/pts")"
|
||||
if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]
|
||||
then
|
||||
sudo mount none -t devpts "$MOUNTED_PATH" || \
|
||||
die "Could not mount $MOUNTED_PATH"
|
||||
fi
|
||||
|
||||
MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}$CHROOT_TRUNK_DIR")"
|
||||
if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]
|
||||
then
|
||||
@ -206,7 +213,10 @@ function teardown_env {
|
||||
else
|
||||
MOUNTED_PATH=$(readlink -f "$FLAGS_chroot")
|
||||
echo "Unmounting chroot environment."
|
||||
for i in $(mount | grep -F "on $MOUNTED_PATH/" | awk '{print $3}'); do
|
||||
# sort the list of mounts in reverse order, to ensure umount of
|
||||
# cascading mounts in proper order
|
||||
for i in \
|
||||
$(mount | grep -F "on $MOUNTED_PATH/" | sort -r | awk '{print $3}'); do
|
||||
safe_umount "$i"
|
||||
done
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user