Fix 'too many levels of symbolic links' error.

In an Ubuntu Precise chroot on the Chromebook Pixel, /run/shm is a
symbolic link to /dev/shm, so bind-mounting /run/shm to /dev/shm
is really bind-mounting /dev/shm to itself, which causes a 'too many
levels of symbolic links' error. To fix this, we check for a symbolic
link prior to running this command.

BUG=none
TEST=cros_sdk no longer prints errors on Chromebook Pixel
Change-Id: Ib46cde2b4a0e00b69bd187488967e445b228ae80
Reviewed-on: https://gerrit.chromium.org/gerrit/45048
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
This commit is contained in:
David James 2013-03-10 21:06:54 -07:00 committed by Michael Marineau
parent a1f5ee388d
commit e01374dc4b

View File

@ -214,9 +214,9 @@ setup_env() {
setup_mount none "-t sysfs" /sys
setup_mount /dev "--bind" /dev
setup_mount none "-t devpts" /dev/pts
if [ -d /run ]; then
if [[ -d /run ]]; then
setup_mount /run "--bind" /run
if [ -d /run/shm ]; then
if [[ -d /run/shm && ! -L /run/shm ]]; then
setup_mount /run/shm "--bind" /run/shm
fi
fi