aboutsummaryrefslogtreecommitdiff
path: root/for-group
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-08 21:10:50 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-08 21:10:50 +0100
commit7b369c861aff6eefb5b0c0530eeb9ab2e3053891 (patch)
tree5df48b46807829b731051388a0bae852324b89d7 /for-group
parenta0f8a70679975f336c54fffd4c22c85c1660c80d (diff)
for-group: Options passed to configure or make
Until now, the `for-group' script could only two options to Make and didn't pass anything to `./configure'. With this commit, any thing given after the first two tokens to `for-group' is passed directly to `./configure' or Make. Also, the test for the existance of the group has been modified to avoid making a temporary file.
Diffstat (limited to 'for-group')
-rwxr-xr-xfor-group27
1 files changed, 17 insertions, 10 deletions
diff --git a/for-group b/for-group
index 90566a6..ef28e98 100755
--- a/for-group
+++ b/for-group
@@ -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"