X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fcros-cbuildbot;h=cdc6b43db2dce5bacd6e86053c6f25eece73ad06;hb=847136a30dbf711fc2ccab762fb294218c8004ea;hp=5456f9aca8b045bfe363e06bf574020ece5c871e;hpb=426a73af283e2965ad200a5c7a9a6c9241f5f425;p=home.git diff --git a/.bin/cros-cbuildbot b/.bin/cros-cbuildbot index 5456f9a..cdc6b43 100755 --- a/.bin/cros-cbuildbot +++ b/.bin/cros-cbuildbot @@ -1,5 +1,7 @@ #!/bin/bash +set -e + vexec() { local i fmt for (( i = 1; i <= $#; ++i )) ; do @@ -17,25 +19,33 @@ vexec() { exec "$@" } -cd ~/chromiumos || exit 1 - -# cache the sudo timestamp -sudo echo "" >/dev/null +cd ~/chromiumos d=/usr/local/google/home/vapier if [[ ! -d ${d} ]] ; then exit 1 fi +if [[ -z ${UNSHARE} ]] ; then + if type -P unshare >&/dev/null ; then + exec sudo unshare -m -- sudo -u ${USER} \ + UNSHARE=true PATH="${PATH}" "$0" "$@" + fi + unset UNSHARE +fi + d+="/trybot" +mkdir -p "${d}" if mount | grep -qs $d ; then echo "mounts found in $d" exit 1 fi -rd=$(readlink $d) -if mount | grep -qs $rd ; then - echo "mounts found in $rd" - exit 1 +if [[ -L $d ]] ; then + rd=$(readlink $d) + if mount | grep -qs $rd ; then + echo "mounts found in $rd" + exit 1 + fi fi if [[ $1 == "--noclean" ]] ; then @@ -45,17 +55,17 @@ elif [[ " $* " != *" --remote "* ]] ; then pushd "${d}" >/dev/null clean=( built-sdk.tbz2 - chroot +# chroot new-sdk-chroot - #sdks + sdks src/build test_results.tgz trybot_archive ) sudo rm -rf "${clean[@]}" - if [[ -d ${d}/sdks ]] ; then - sudo find "${d}"/sdks -mtime +3 -delete - fi +# [[ -L .cache ]] && rm -f .cache || : +# mkdir -p .cache +# sudo mount --bind -n ~/chromiumos/.cache .cache popd >/dev/null fi @@ -88,5 +98,6 @@ if [[ -n ${repos} ]] ; then set -- -p "${p_flag}" "$@" fi +set -- --cache-dir=~/chromiumos/.cache "$@" vexec cbuildbot --buildroot=${d} "$@"