From 3c3472397719ec968f76774e15f01139b96c90b7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 13 Dec 2011 19:07:15 -0500 Subject: [PATCH] my chromeos helpers --- .bin/cros-board | 94 +++++++++++++++++++++++++++++++++++++++++++++ .bin/cros-cbuildbot | 47 +++++++++++++++++++++++ .bin/cros-repo | 27 +++++++++++++ 3 files changed, 168 insertions(+) create mode 100755 .bin/cros-board create mode 100755 .bin/cros-cbuildbot create mode 100755 .bin/cros-repo diff --git a/.bin/cros-board b/.bin/cros-board new file mode 100755 index 0000000..ac1126a --- /dev/null +++ b/.bin/cros-board @@ -0,0 +1,94 @@ +#!/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 < [command opts] + + Commands: + int switch to internal tree + ext switch to external tree + -b 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 -- 2.39.5