mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 06:31:18 +02:00
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 <davidjames@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
ef4a6452d4
commit
40bb0c3152
@ -254,7 +254,8 @@ function setup_env {
|
|||||||
if [ -n "${SSH_AUTH_SOCK}" -a -d "${HOME}/.ssh" ]; then
|
if [ -n "${SSH_AUTH_SOCK}" -a -d "${HOME}/.ssh" ]; then
|
||||||
TARGET_DIR="${FLAGS_chroot}/home/${USER}/.ssh"
|
TARGET_DIR="${FLAGS_chroot}/home/${USER}/.ssh"
|
||||||
mkdir -p "${TARGET_DIR}"
|
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}"
|
copy_ssh_config "${TARGET_DIR}"
|
||||||
ASOCK=${SSH_AUTH_SOCK%/*}
|
ASOCK=${SSH_AUTH_SOCK%/*}
|
||||||
ensure_mounted "${ASOCK}" "--bind" "${ASOCK}"
|
ensure_mounted "${ASOCK}" "--bind" "${ASOCK}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user