Use correct log functions for enter_chroot's console spew.

Change-Id: Ie0e05626e3619584d565ff3414f1d1b073c7fc7f

BUG=
TEST=Manually

Review URL: http://codereview.chromium.org/3318005
This commit is contained in:
Sean O 2010-09-02 17:34:49 +02:00
parent 7aace25881
commit cd8b1d1729

View File

@ -81,7 +81,7 @@ function setup_env {
flock 200 flock 200
echo $$ >> "$LOCKFILE" echo $$ >> "$LOCKFILE"
echo >&2 "Mounting chroot environment." info "Mounting chroot environment."
# Mount only if not already mounted # Mount only if not already mounted
MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/proc")" MOUNTED_PATH="$(readlink -f "$FLAGS_chroot/proc")"
@ -142,10 +142,10 @@ function setup_env {
2>/dev/null)" 2>/dev/null)"
fi fi
if [[ ( -z "$CHROME_ROOT" ) || ( ! -d "${CHROME_ROOT}/src" ) ]]; then if [[ ( -z "$CHROME_ROOT" ) || ( ! -d "${CHROME_ROOT}/src" ) ]]; then
echo >&2 "Not mounting chrome source" info "Not mounting chrome source"
sudo rm -f "${FLAGS_chroot}${CHROME_ROOT_CONFIG}" sudo rm -f "${FLAGS_chroot}${CHROME_ROOT_CONFIG}"
else else
echo >&2 "Mounting chrome source at: $INNER_CHROME_ROOT" info "Mounting chrome source at: $INNER_CHROME_ROOT"
echo "$CHROME_ROOT" | \ echo "$CHROME_ROOT" | \
sudo dd of="${FLAGS_chroot}${CHROME_ROOT_CONFIG}" sudo dd of="${FLAGS_chroot}${CHROME_ROOT_CONFIG}"
mkdir -p "$MOUNTED_PATH" mkdir -p "$MOUNTED_PATH"
@ -158,12 +158,12 @@ function setup_env {
if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ] if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]
then then
if [ $(which gclient 2>/dev/null) ]; then if [ $(which gclient 2>/dev/null) ]; then
echo >&2 "Mounting depot_tools" info "Mounting depot_tools"
DEPOT_TOOLS=$(dirname $(which gclient) ) DEPOT_TOOLS=$(dirname $(which gclient) )
mkdir -p "$MOUNTED_PATH" mkdir -p "$MOUNTED_PATH"
if ! sudo mount --bind "$DEPOT_TOOLS" "$MOUNTED_PATH"; then if ! sudo mount --bind "$DEPOT_TOOLS" "$MOUNTED_PATH"; then
echo >&2 "depot_tools failed to mount; perhaps it's on NFS?" warn "depot_tools failed to mount; perhaps it's on NFS?"
echo >&2 "This may impact chromium build." warn "This may impact chromium build."
fi fi
fi fi
fi fi
@ -171,7 +171,7 @@ function setup_env {
# Install fuse module. # Install fuse module.
if [ -c "${FUSE_DEVICE}" ] ; then if [ -c "${FUSE_DEVICE}" ] ; then
sudo modprobe fuse 2> /dev/null ||\ sudo modprobe fuse 2> /dev/null ||\
echo >&2 "-- Note: modprobe fuse failed. gmergefs will not work" warn "-- Note: modprobe fuse failed. gmergefs will not work"
fi fi
# Turn off automounting of external media when we enter the # Turn off automounting of external media when we enter the
@ -181,10 +181,10 @@ function setup_env {
gconftool-2 -g ${AUTOMOUNT_PREF} > \ gconftool-2 -g ${AUTOMOUNT_PREF} > \
"${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}" "${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}"
if [ $(gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} false) ]; then if [ $(gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} false) ]; then
echo >&2 "-- Note: USB sticks may be automounted by your host OS." warn "-- Note: USB sticks may be automounted by your host OS."
echo >&2 "-- Note: If you plan to burn bootable media, you may need to" warn "-- Note: If you plan to burn bootable media, you may need to"
echo >&2 "-- Note: unmount these devices manually, or run image_to_usb.sh" warn "-- Note: unmount these devices manually, or run image_to_usb.sh"
echo >&2 "-- Note: outside the chroot." warn "-- Note: outside the chroot."
fi fi
fi fi
@ -219,15 +219,15 @@ function teardown_env {
if [ $(which gconftool-2 2>/dev/null) ]; then if [ $(which gconftool-2 2>/dev/null) ]; then
SAVED_PREF=$(cat "${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}") SAVED_PREF=$(cat "${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}")
gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} ${SAVED_PREF} || \ gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} ${SAVED_PREF} || \
echo >&2 "could not re-set your automount preference." warn "could not re-set your automount preference."
fi fi
if [ -s "$LOCKFILE" ]; then if [ -s "$LOCKFILE" ]; then
echo >&2 "At least one other pid is running in the chroot, so not" info "At least one other pid is running in the chroot, so not"
echo >&2 "tearing down env." info "tearing down env."
else else
MOUNTED_PATH=$(readlink -f "$FLAGS_chroot") MOUNTED_PATH=$(readlink -f "$FLAGS_chroot")
echo >&2 "Unmounting chroot environment." info "Unmounting chroot environment."
# sort the list of mounts in reverse order, to ensure umount of # sort the list of mounts in reverse order, to ensure umount of
# cascading mounts in proper order # cascading mounts in proper order
for i in \ for i in \
@ -241,10 +241,10 @@ function teardown_env {
if [ $FLAGS_mount -eq $FLAGS_TRUE ] if [ $FLAGS_mount -eq $FLAGS_TRUE ]
then then
setup_env setup_env
echo >&2 "Make sure you run" info "Make sure you run"
echo >&2 " $0 --unmount" info " $0 --unmount"
echo >&2 "before deleting $FLAGS_chroot" info "before deleting $FLAGS_chroot"
echo >&2 "or you'll end up deleting $FLAGS_trunk too!" info "or you'll end up deleting $FLAGS_trunk too!"
exit 0 exit 0
fi fi
@ -276,7 +276,7 @@ REVISION=$(git rev-parse --short=8 HEAD)
CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL" CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL"
if [ -d "$HOME/.subversion" ]; then if [ -d "$HOME/.subversion" ]; then
# Bind mounting .subversion into chroot # Bind mounting .subversion into chroot
echo >&2 "mounting ~/.subversion into chroot" info "mounting ~/.subversion into chroot"
MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")"
if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then
mkdir -p "$MOUNTED_PATH" mkdir -p "$MOUNTED_PATH"