Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: enter_chroot.sh

Issue 6065011: enter_chroot: copy over ssh configuration (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to enter the chroot environment 7 # Script to enter the chroot environment
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 die "Could not mount $MOUNTED_PATH" 135 die "Could not mount $MOUNTED_PATH"
136 fi 136 fi
137 137
138 if [ $FLAGS_ssh_agent -eq $FLAGS_TRUE ]; then 138 if [ $FLAGS_ssh_agent -eq $FLAGS_TRUE ]; then
139 TARGET_DIR="$(readlink -f "${FLAGS_chroot}/home/${USER}/.ssh")" 139 TARGET_DIR="$(readlink -f "${FLAGS_chroot}/home/${USER}/.ssh")"
140 if [ -n "${SSH_AUTH_SOCK}" \ 140 if [ -n "${SSH_AUTH_SOCK}" \
141 -a -d "${HOME}/.ssh" ] 141 -a -d "${HOME}/.ssh" ]
142 then 142 then
143 mkdir -p "${TARGET_DIR}" 143 mkdir -p "${TARGET_DIR}"
144 cp -r "${HOME}/.ssh/known_hosts" "${TARGET_DIR}" 144 cp -r "${HOME}/.ssh/known_hosts" "${TARGET_DIR}"
145 cp -r "${HOME}/.ssh/config" "${TARGET_DIR}"
145 ASOCK="$(dirname "${SSH_AUTH_SOCK}")" 146 ASOCK="$(dirname "${SSH_AUTH_SOCK}")"
146 mkdir -p "${FLAGS_chroot}/${ASOCK}" 147 mkdir -p "${FLAGS_chroot}/${ASOCK}"
147 sudo mount --bind "${ASOCK}" "${FLAGS_chroot}/${ASOCK}" || \ 148 sudo mount --bind "${ASOCK}" "${FLAGS_chroot}/${ASOCK}" || \
148 die "Count not mount ${ASOCK}" 149 die "Count not mount ${ASOCK}"
149 fi 150 fi
150 fi 151 fi
151 152
152 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/dev/pts")" 153 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/dev/pts")"
153 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] 154 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]
154 then 155 then
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 # Run command or interactive shell. Also include the non-chrooted path to 334 # Run command or interactive shell. Also include the non-chrooted path to
334 # the source trunk for scripts that may need to print it (e.g. 335 # the source trunk for scripts that may need to print it (e.g.
335 # build_image.sh). 336 # build_image.sh).
336 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ 337 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
337 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ 338 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \
338 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" 339 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@"
339 340
340 # Remove trap and explicitly unmount 341 # Remove trap and explicitly unmount
341 trap - EXIT 342 trap - EXIT
342 teardown_env 343 teardown_env
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698