enter_chroot: skip ssh agent dir if it is invalid
On long running systems, the ssh-agent dir might go stale. This should
not prevent entering the cros chroot though, so skip it if it's invalid.
BUG=None
TEST=`cros_sdk` enters with ssh-agent dir bind mounted
TEST=`rm -rf /tmp/ssh-*/; cros_sdk` enters with ssh-agent dir skipped
Change-Id: I923b031612c0d37a896437c7355cac6c448eef82
Reviewed-on: https://gerrit.chromium.org/gerrit/12758
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index c581daa..f55d3a5 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -257,8 +257,12 @@
# Ignore errors as some people won't have these files to copy.
cp "${HOME}"/.ssh/{known_hosts,*.pub} "${TARGET_DIR}/" 2>/dev/null || :
copy_ssh_config "${TARGET_DIR}"
+
+ # Don't try to bind mount the ssh agent dir if it has gone stale.
ASOCK=${SSH_AUTH_SOCK%/*}
- queue_mount "${ASOCK}" "--bind" "${ASOCK}"
+ if [ -d "${ASOCK}" ]; then
+ queue_mount "${ASOCK}" "--bind" "${ASOCK}"
+ fi
fi
fi