--- /dev/null
+#!/bin/bash
+COMMAND=$(basename $0)
+BUILD_SCM_URL="git://git.onelab.eu/build"
+
+# scan args for any -s option, and set BUILD_SCM_URL in this case
+function scan_build_scm_url () {
+ while [[ -n "$@" ]] ; do
+ if [ "$1" == "-s" ] ; then
+ BUILD_SCM_URL="$2"
+ fi
+ shift
+ done
+
+ GIT_REPO=$(echo $BUILD_SCM_URL | cut -d@ -f1)
+ GIT_TAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2)
+ GIT_TAG=${GIT_TAG:-master}
+}
+
+scan_build_scm_url "$@"
+
+tmpd=/tmp/git-$$
+tmpc=$tmpd/$COMMAND
+mkdir $tmpd
+git archive --remote=$GIT_REPO $GIT_TAG $COMMAND | tar -C $tmpd -xf -
+chmod +x $tmpc
+$tmpc "$@"
+rm -rf $tmpd