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>
This commit is contained in:
Mike Frysinger 2011-12-12 14:21:44 -05:00 committed by Gerrit
parent a63da3a776
commit 9de707f77e

View File

@ -257,8 +257,12 @@ function setup_env {
# 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