diff options
Diffstat (limited to 'for-group')
-rwxr-xr-x | for-group | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -2,8 +2,8 @@ # # Running examples: # -# $ ./for-group group_name configure -# $ ./for-group group_name make [-jN] +# $ ./for-group group_name configure [OPTIONS] +# $ ./for-group group_name make [OPTIONS] # # This is a wrapper for the configure and Make steps designed for a group # of users (sharing the same group name) using this pipeline on the same @@ -61,21 +61,28 @@ fi +# Prepare any other argument to pass onto the `./configure' or `make' +# commands. `$@' is the list of command-line tokens given to the this +# (`./for-group') script. Therefore, the first token in it is the group +# name and the second is the script name. As a result, we want anything +# after the third token. +options=$(echo "$@" | awk '{for(i=3;i<=NF;++i) printf("%s ", $i)}') + + + + + # Make sure the given group is usable. -testfile=".reproducible-pipeline-group-test" -if sg "$1" "echo test > $testfile"; then - rm $testfile +if sg "$1" "echo test &> /dev/null" &> /dev/null; then if [ "x$2" = xconfigure ]; then script="./configure" - elif [ "x$2" = xmake ]; then script=".local/bin/make $3 $4" + elif [ "x$2" = xmake ]; then script=".local/bin/make" else echo "$0: a third argument is necessary." echo "It specifies the action: either 'configure' or 'make'" exit 1 fi else - rm $testfile - echo - echo "$0: '$1' is not a usable group name!"; + echo "$0: '$1' is not a usable group name on this system."; echo "TIP: you can use the 'groups' command to see your groups." exit 1 fi @@ -91,7 +98,7 @@ fi # prepare for sanity checks and avoid re-doing the whole analysis with a # typo (not using this script properly after configuration). export reproducible_paper_group_name="$1" -sg "$1" "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && $script" +sg "$1" "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && $script $options" |