From: Timo Heister Date: Mon, 8 Feb 2016 22:24:03 +0000 (-0500) Subject: add -h, validate PROCS, update README X-Git-Tag: v0.8.4~6^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33de882eb599fb226313df7e33a25f5786dd602b;p=candi.git add -h, validate PROCS, update README --- diff --git a/README.md b/README.md index a6be867..5361d33 100644 --- a/README.md +++ b/README.md @@ -71,14 +71,13 @@ Adapting candi to your needs $> ./candi.sh --prefix=Your/Prefix/Path ``` -#### CLO: Multiple build processes: `[-j]`, `[--PROCS=]` +#### CLO: Multiple build processes: `[-j ]`, `[-j]`, `[--PROCS=]` ```bash - $> ./candi.sh -j + $> ./candi.sh -j ``` -* Remark: there is no whitespace character allowed between `-j` and the number ``. -* Example: using 2 build processes type `./candi.sh -j2` or `./candi.sh --PROCS=2`. -* Be careful with that! You need to have enough system memory (e.g. at least 8GB for using 2 or more processes). +* Example: to use 2 build processes type `./candi.sh -j2`. +* Be careful with this option! You need to have enough system memory (e.g. at least 8GB for 2 or more processes). ### Configuration file options (CFO) diff --git a/candi.sh b/candi.sh index c8668c7..2e931f7 100755 --- a/candi.sh +++ b/candi.sh @@ -39,9 +39,26 @@ TIC_GLOBAL="$(${DATE_CMD} +%s%N)" ################################################################################ # Parse command line input parameters +PREFIX=~/apps/candi +PROCS=1 + while [ -n "$1" ]; do param="$1" case $param in + + -h|--help) + echo "candi (Compile & Install)" + echo "" + echo "Usage: $0 [options]" + echo "Options:" + echo " -p , --prefix= set a different prefix path (default $PREFIX)" + echo " -j , -j, --PROCS= compile with N processes in parallel (default $PROCS)" + echo " --platform= force usage of a particular platform file" + echo "" + echo "The configuration including the choice of packages to install is stored in candi.cfg, see README.md for more information." + exit 0 + ;; + ##################################### # Prefix path -p=*|--prefix=*) @@ -53,17 +70,17 @@ while [ -n "$1" ]; do ##################################### # Number of maximum processes to use --PROCS=*) - NP="${param#*=}" + PROCS="${param#*=}" ;; # Make styled processes with or without space -j) shift - NP="${1}" + PROCS="${1}" ;; -j*) - NP="${param#*j}" + PROCS="${param#*j}" ;; ##################################### @@ -77,7 +94,12 @@ while [ -n "$1" ]; do done PREFIX_PATH=${PREFIX:-~/apps/candi} -PROCS=${NP:-1} + +RE='^[0-9]+$' +if [[ ! "$PROCS" =~ $RE || $PROCS<1 ]] ; then + echo "ERROR: invalid number of build processes '$PROCS'" + exit 1 +fi ################################################################################ # Set download tool