#!/bin/bash function usage() { cat <] [-g ] [-f ] command [args] commands: build -- pull and rebuild the code version -- print the current build number setup -- create base directory and config files run -- run a turn send [id ...] -- send reports to one or more factions, or to all ids in HEREDOC exit 1 } function abort() { echo $1 [ -z $2 ] && exit -1 exit $2 # otherwise } function build() { assert_dir $SOURCE cd $SOURCE rm -rf crypto tolua git fetch || abort "failed to update source. do you have local changes?" [ -z $1 ] || git checkout $1 git pull git submodule update s/build > /dev/null || abort "build failed." } function assert_file() { [ -e $1 ] || abort "missing file: $1" } function assert_files() { while [ ! -z $1 ] ; do assert_file $1 shift done } function assert_dir() { [ -d $1 ] || abort "missing directory: $1" } function setup() { assert_dir $SOURCE assert_dir $LIVE mkdir -p $TESTROOT assert_dir $TESTROOT cd $TESTROOT cat >| eressea.ini <