diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-02-05 18:19:46 +0000 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-02-05 18:19:46 +0000 |
commit | 438e1970093621d3c67acc900b17afdeaa60329f (patch) | |
tree | 2e97ac257f1548973a5e28333bca5e0c2713f637 /for-group | |
parent | f41be41e376dfd521881ad2e6137360e549777de (diff) |
for-group: better check of group name and fixed make argument
A few issues came up while testing the `for-group' script in one of the
projects based on this pipeline that are being fixed with this commit:
1) We are ultimately using the `sg' command to use the specified group,
not `chgrp'. So in cases where `chgrp' has problems, this would cause
a wrong error. So for the test of the given group's existance, we are
now directly calling `sg'.
2) In the call to `make' we were mistakenly giving make the `$2' (which
is `make' on the command-line) argument. Since `./for-group' now takes
the group name as its first argument, this should have been `$3'.
3) To help in readability, and also allow for group names with a space,
`reproducible_paper_group_name' is now defined and exported before the
final call to `sg'.
Diffstat (limited to 'for-group')
-rwxr-xr-x | for-group | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -57,16 +57,19 @@ if [ "x$1" = x ]; then exit 1 fi + + + + # Make sure the given group is usable. testfile=".reproducible-pipeline-group-test" -echo "Just for a test" > $testfile -if chgrp $1 $testfile; then +if sg "$1" "echo test > $testfile"; then rm $testfile if [ "x$2" = xconfigure ]; then script="./configure" - elif [ "x$2" = xmake ]; then script=".local/bin/make $2" + elif [ "x$2" = xmake ]; then script=".local/bin/make $3" else echo "$0: a third argument is necessary." - echo "It specifies the action: 'configure' or 'make'" + echo "It specifies the action: either 'configure' or 'make'" exit 1 fi else @@ -87,4 +90,5 @@ 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 $1 "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && export reproducible_paper_group_name=$1 && $script" +export reproducible_paper_group_name="$1" +sg "$1" "umask u+r,u+w,g+r,g+w,o-r,o-w,o-x && $script" |