--- /dev/null
+#!/bin/bash
+. /etc/init.d/functions.sh || exit 1
+die() { eerror "$*"; exit 1; }
+set -e
+
+cd ${HOME}/trunk/src/scripts/
+
+if [[ -z ${BOARD} ]] ; then
+ die "missing BOARD"
+fi
+IMAGES="${HOME}/trunk/src/build/images/${BOARD}"
+BUILD="/build/${BOARD}"
+
+ARG_CLEAN=false
+ARG_DEV="/dev/sdb"
+ARG_DEV_USER=false
+ARG_PRETEND=false
+ARG_NOPKG=false
+ARG_VERBOSE=false
+ARG_TEST=false
+while [[ $# -ne 0 ]] ; do
+ case $1 in
+ --clean) ARG_CLEAN=true;;
+ -p) ARG_PRETEND=true;;
+ -y) shift; ARG_DEV=$1; ARG_DEV_USER=true;;
+ -v) ARG_VERBOSE=true;;
+ -t) ARG_TEST=true;;
+ --nousepkg) ARG_NOPKG=true;;
+ *) echo "unknown opt: $*"; exit 1;;
+ esac
+ shift
+done
+
+piperet() { set -- ${PIPESTATUS[@]/0}; [[ $# -eq 0 ]]; }
+run() {
+ set +e
+ ebegin "$*"
+ if ! ${ARG_PRETEND} ; then
+ local log="${IMAGES}"/log.${1##*/}
+ if ${ARG_VERBOSE} ; then
+ "$@" |& tee "${log}"
+ else
+ "$@" >& "${log}"
+ fi
+ piperet
+ fi
+ eend $? || exit $?
+ set -e
+}
+
+tfe() { ($1 && echo $2 || :); }
+
+mkdir -p "${IMAGES}"
+rm -f "${IMAGES}"/log.*
+
+einfo "Log root: ${IMAGES}/log."
+
+if ${ARG_CLEAN} || [[ ! -d ${BUILD} ]] ; then
+ run sudo rm -rf "${BUILD}"
+ run ./setup_board --board=${BOARD}
+ if [ $? -ne 0 ] ; then
+ run sudo rm -rf "${BUILD}"
+ exit 1
+ fi
+fi
+
+run ./build_packages --board=${BOARD} --oldchromebinary --nowithdebug $(tfe ${ARG_NOPKG} --nousepkg) $(tfe ${ARG_TEST} --withtest)
+BUILD_IMG="./build_image --board=${BOARD} --withdev --noenable_rootfs_verification $(tfe ${ARG_TEST} --test)"
+run ${BUILD_IMG}
+
+IMG_TO_USB="./image_to_usb.sh --board=${BOARD} -y --to=${ARG_DEV}"
+if ${ARG_DEV_USER} ; then
+ run ${IMG_TO_USB}
+ sync &
+fi
+
+cat <<EOF
+
+### LIVE
+${IMG_TO_USB}
+
+### KVM
+./image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
+kvm -m 1024 -vga std -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 -hda ~/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
+
+### RECOVERY
+./mod_image_for_recovery.sh --board=${BOARD}
+${IMG_TO_USB} --image_name=recovery_image.bin
+
+### FACTORY
+${BUILD_IMG} --factory_install
+${IMG_TO_USB} -i factory_install_shim.bin
+
+EOF
--- /dev/null
+#!/bin/bash
+
+d=/usr/local/google/home/vapier
+if [[ -d ${d} ]] ; then
+ d+="/trybot"
+ if mount | grep -qs $d ; then
+ echo "mounts found in $d"
+ exit 1
+ fi
+
+ echo "Cleaning ${d}"
+ sudo rm -rf ${d}
+else
+ exit 1
+fi
+
+# find all the buildbot branches
+repos=$(r b | cut -b4- | awk '$1 == "bb" {
+ # Single repo output:
+ # bb | in src/third_party/portage-stable
+ # Multi repo output:
+ # bb | in:
+ # src/third_party/portage-stable
+ # src/third_party/chromiumos-overlay
+ if ($3 == "in")
+ print $NF
+ while (getline) {
+ if ($2 == "|")
+ break;
+ print $NF;
+ }
+}')
+if [[ -n ${repos} ]] ; then
+ echo "Auto pulling patches from 'bb' branch in repos:"
+ printf '\t%s\n' ${repos}
+
+ p_flag=""
+ for r in ${repos} ; do
+ r=$(r list | awk -v r="${r}" '$1 == r { print $NF }')
+ p_flag+="${r}:bb "
+ done
+
+ set -- -p "${p_flag}" "$@"
+fi
+
+vexec() { echo "$@"; exec "$@"; }
+vexec cbuildbot --buildroot=${d} "$@"
--- /dev/null
+#!/bin/sh
+cd ~/chromiumos
+
+usage() {
+ cat <<-EOF
+ Usage: repo-cros <command> [command opts]
+
+ Commands:
+ int switch to internal tree
+ ext switch to external tree
+ -b <branch> switch branches
+ EOF
+ exit ${1:-1}
+}
+[[ $# -eq 0 ]] && usage
+
+vexec() { echo "$@"; exec "$@"; }
+
+while [[ $# -gt 0 ]] ; do
+ case $1 in
+ int) vexec repo init -u ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal.git --repo-url='http://git.chromium.org/external/repo.git' ;;
+ ext) vexec repo init -u http://git.chromium.org/chromiumos/manifest.git --repo-url http://git.chromium.org/external/repo.git ;;
+ -b) vexec repo init -b $2 ;;
+ *) usage ;;
+ esac
+done
+exit 0