enter_chroot: handle /var/lock->/run/lock symlinks

Newer Gentoo builds have moved to /run which means /var/lock is a symlink
to /run/lock.  But since that is an absolute symlink, it points outside of
the chroot which doesn't work for us.  Use a stable path unrelated to the
chroot instead, but only with newer chroots.

We no longer have to worry about backwards compat because the code that
used to rely on this lock file (running sync processes) was punted a long
time ago.

BUG=chromium:218085
TEST=`cbuildbot chromiumos-sdk` passes

Change-Id: I38c6848dfb86386849050d7ccf3f90cbbe8e0e81
Reviewed-on: https://gerrit.chromium.org/gerrit/46231
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2013-03-22 00:59:58 -04:00 committed by Michael Marineau
parent b957c775ea
commit 0c0fea7b4d

View File

@ -91,9 +91,9 @@ INNER_CHROME_ROOT=$FLAGS_chrome_root_mount # inside chroot
CHROME_ROOT_CONFIG="/var/cache/chrome_root" # inside chroot
FUSE_DEVICE="/dev/fuse"
chmod 0777 "$FLAGS_chroot/var/lock"
LOCKFILE="$FLAGS_chroot/var/lock/enter_chroot"
# We can't use /var/lock because that might be a symlink to /run/lock outside
# of the chroot. Or /run on the host system might not exist.
LOCKFILE="${FLAGS_chroot}/.enter_chroot.lock"
MOUNTED_PATH=$(readlink -f "$FLAGS_chroot")
# Reset the depot tools/internal trunk pathways to what they'll