aboutsummaryrefslogtreecommitdiff
path: root/for-group
diff options
context:
space:
mode:
Diffstat (limited to 'for-group')
-rwxr-xr-xfor-group45
1 files changed, 28 insertions, 17 deletions
diff --git a/for-group b/for-group
index 7484a09..1d96fc3 100755
--- a/for-group
+++ b/for-group
@@ -1,9 +1,9 @@
-#! /bin/sh
+#! /bin/bash
#
# Running examples:
#
-# $ ./for-group configure
-# $ ./for-group make [-jN]
+# $ ./for-group group_name configure
+# $ ./for-group group_name make [-jN]
#
# 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
@@ -13,7 +13,7 @@
# (normally done with `.local/bin/make') steps are done with this script,
# all the files that are created within the pipeline have these properties:
#
-# 1) Group owner will be a special group (value of `thisgroup' below).
+# 1) Group owner will be the group specified in the command-line.
# 2) The permission flags give write access to the group members.
#
# Original author:
@@ -39,13 +39,6 @@
-# Desired group
-thisgroup=YOUR-GROUP
-
-
-
-
-
# Script settings
# ---------------
# Stop the script if there are any errors.
@@ -55,14 +48,32 @@ set -e
-# Set and run the respective command.
+# See if any argument are given at all.
if [ "x$1" = x ]; then
- echo "$0: an argument is necessary ('configure' or 'make')"
+ echo "$0: At least two arguments are necessary:"
+ echo
+ echo " To configure: $ ./for-group group_name configure"
+ echo " To build: $ ./for-group group_name make"
exit 1
-elif [ "x$1" = xconfigure ]; then script="./configure"
-elif [ "x$1" = xmake ]; then script=".local/bin/make $2"
+fi
+
+# Make sure the given group is usable.
+testfile=".reproducible-pipeline-group-test"
+echo "Just for a test" > $testfile
+if chgrp $1 $testfile; then
+ rm $testfile
+ if [ "x$2" = xconfigure ]; then script="./configure"
+ elif [ "x$2" = xmake ]; then script=".local/bin/make $2"
+ else
+ echo "$0: a third argument is necessary."
+ echo "It specifies the action: 'configure' or 'make'"
+ exit 1
+ fi
else
- echo "$0: argument must be 'configure' or 'make'"
+ rm $testfile
+ echo
+ echo "$0: '$1' is not a usable group name!";
+ echo "TIP: you can use the 'groups' command to see your groups."
exit 1
fi
@@ -76,4 +87,4 @@ fi
# We are also exporting a special variable so `./configure' and Make can
# prepare for sanity checks and avoid re-doing the whole analysis with a
# typo (not using this script properly after configuration).
-sg $thisgroup "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && export reproducible_paper_for_group=yes && $script"
+sg $1 "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && export reproducible_paper_group_name=$1 && $script"