aboutsummaryrefslogtreecommitdiff
path: root/for-group
blob: 66eebf40f68ca7df0ad5188b19a02fd20734c528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/sh
#
# Running examples:
#
#    $ ./for-group configure
#    $ ./for-group 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
# build directory.
#
# When the configuration (normally done with `./configure') and build
# (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).
#   2) The permission flags give write access to the group members.
#
# Original author:
#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
# Contributing author(s):
#     Your name <your@email.address>
# Copyright (C) 2019, Mohammad Akhlaghi.
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# A copy of the GNU General Public License is available at
# <http://www.gnu.org/licenses/>.





# Desired group
thisgroup=ourgroup





# Script settings
# ---------------
# Stop the script if there are any errors.
set -e





# Set and run the respective command.
if [   "x$1" = x          ]; then
    echo "$0: an argument is necessary ('configure' or 'make')"
    exit 1
elif [ "x$1" = xconfigure ]; then script="./configure"
elif [ "x$1" = xmake      ]; then script=".local/bin/make $2"
else
    echo "$0: argument must be 'configure' or 'make'"
    exit 1
fi
echo; echo $script; echo
sg $thisgroup "umask g+w && $script"