From 35604bdef0479fec92654d0722bbae26c7455c2a Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Thu, 7 Aug 2014 14:36:02 +0200 Subject: [PATCH] set GLUON_BRANCH via option and add print_usage() --- build.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5d00bc7..52f4d3a 100755 --- a/build.sh +++ b/build.sh @@ -1,13 +1,66 @@ #!/bin/bash +# (pushd/popd needs an advanced shell) set -e SCRIPTDIR=$(dirname $0) +print_usage() { + echo "Usage: $0 [GLUON_BRANCH]" + echo '' + echo 'If GLUON_BRANCH is not given, experimental is set.' + echo '' + echo 'Options:' + echo ' -h show this help' +} + +# command line options handling +ARGS=`getopt h $*` +if [ $? -ne 0 ] +then + print_usage + exit 2 +fi +set -- $ARGS + +while true +do + case "$1" in + -h) + print_usage + exit 0 + ;; + --) + shift; break;; + esac +done + +# set GLUON_BRANCH for manifest +if [ -z "$1" ] +then + GLUON_BRANCH=experimental + echo 'Set GLUON_BRANCH to "experimental"!' +else + GLUON_BRANCH=$1 +fi + +case "xx$GLUON_BRANCH" in + 'xxstable'|'xxbeta'|'xxexperimental') + # fine + ;; + *) + echo "Unknown GLUON_BRANCH '$1'." + echo 'Use "stable", "beta", or "experimental"!' + exit 1 + ;; +esac + +# get GLUON_CHECKOUT from site dir pushd ${SCRIPTDIR} eval `make -s -f helper.mk` echo "GLUON_CHECKOUT: ${GLUON_CHECKOUT}" +# build pushd .. git checkout master git pull @@ -15,9 +68,11 @@ git checkout ${GLUON_CHECKOUT} make clean make update make all -j4 -make manifest +GLUON_BRANCH=${GLUON_BRANCH} make manifest popd popd exit 0 + +# vim: set et sts=0 ts=4 sw=4 sr: