Correct promotion of ssh for chrome-bot.
In some circumstances the user is root but the sudo user is
chrome-bot. The copy would then be from the wrong source, yielding
either incorrect results or a failure.
BUG=chromium:247410
TEST=proof-of-concept run on test machine
Change-Id: Ife9e1eb6ece77f253d21af8d73860ba7d251b5a3
Reviewed-on: https://gerrit.chromium.org/gerrit/57804
Reviewed-by: Chris Wolfe <cwolfe@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
Commit-Queue: Peter Mayo <petermayo@chromium.org>
Tested-by: Peter Mayo <petermayo@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 9156571..f9fb77a 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -293,9 +293,9 @@
echo ". ~/trunk/src/scripts/bash_completion" \
| user_append "$FLAGS_chroot/home/${SUDO_USER}/.bashrc"
- if [[ "${SUDO_USER}" = "chrome-bot" ]]; then
+ if [[ "${SUDO_USER}" = "chrome-bot" && -d "${SUDO_HOME}/.ssh" ]]; then
# Copy ssh keys, so chroot'd chrome-bot can scp files from chrome-web.
- cp -rp ~/.ssh "$FLAGS_chroot/home/${SUDO_USER}/"
+ cp -rp "${SUDO_HOME}/.ssh" "$FLAGS_chroot/home/${SUDO_USER}/"
fi
if [[ -f ${SUDO_HOME}/.gitconfig ]]; then