From 40bb0c3152e635a680be2f0163675752d3e2f82d Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 31 Oct 2011 17:14:15 -0400 Subject: [PATCH] enter_chroot: ignore errors from copying user ssh files The current code that syncs the user's ssh files from ~/.ssh/ to the chroot assumes the user has these files in the first place. For the fresh user and/or install, these might not exist. So ignore errors from attempting to copy them. It's not like we attempt to "recover" anyways, and this sync is more of a "let's make things smoother" than a "we need this to run properly". BUG=chromium-os:15005 TEST=`mv ~/.ssh ~/.ssh.bak; mkdir ~/.ssh; cros_sdk` and see no more warnings Change-Id: I9cac2ecad7c64c088fbdfe55377c0429b3b7ab03 Reviewed-on: https://gerrit.chromium.org/gerrit/10922 Reviewed-by: David James Tested-by: Mike Frysinger Commit-Ready: Mike Frysinger --- sdk_lib/enter_chroot.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 3fb61d7b9b..377e565485 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -254,7 +254,8 @@ function setup_env { if [ -n "${SSH_AUTH_SOCK}" -a -d "${HOME}/.ssh" ]; then TARGET_DIR="${FLAGS_chroot}/home/${USER}/.ssh" mkdir -p "${TARGET_DIR}" - cp "${HOME}"/.ssh/{known_hosts,*.pub} "${TARGET_DIR}/" + # 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}" ASOCK=${SSH_AUTH_SOCK%/*} ensure_mounted "${ASOCK}" "--bind" "${ASOCK}"