fixes, and cleanup vbuild*
[infrastructure.git] / scripts / lbuild-nightly.sh
1 #!/bin/bash
2 COMMAND=$(basename $0)
3 BUILD_SCM_URL="git://git.onelab.eu/build"
4
5 # scan args for any -s option, and set BUILD_SCM_URL in this case
6 function scan_build_scm_url () {
7     while [[ -n "$@" ]] ; do
8         if [ "$1" == "-s" ] ; then
9             BUILD_SCM_URL="$2"
10         fi
11         shift
12     done
13
14     GIT_REPO=$(echo $BUILD_SCM_URL | cut -d@ -f1)
15     GIT_TAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2)
16     GIT_TAG=${GIT_TAG:-master}
17 }
18
19 scan_build_scm_url "$@"
20
21 tmpd=/tmp/git-$$
22 tmpc=$tmpd/$COMMAND
23 mkdir $tmpd
24 git archive --remote=$GIT_REPO $GIT_TAG $COMMAND | tar -C $tmpd -xf -
25 chmod +x $tmpc
26 $tmpc "$@"
27 rm -rf $tmpd