1 |
c2a36c08
|
Andreas Kohlbecker
|
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
# -- options
|
5 |
|
|
while [[ "$#" -gt 0 ]]; do
|
6 |
|
|
case $1 in
|
7 |
|
|
-h|--help) print_help=1;;
|
8 |
|
|
--web-user) web_user="$2"; shift ;;
|
9 |
|
|
--admin-user) admin_user=$2 ;;
|
10 |
|
|
*) echo "Unknown parameter passed: $1"; exit 1 ;;
|
11 |
|
|
esac
|
12 |
|
|
shift
|
13 |
|
|
done
|
14 |
|
|
|
15 |
|
|
if [[ -z "${web_user}${admin_user}" ]]; then
|
16 |
|
|
print_help="1"
|
17 |
|
|
fi
|
18 |
|
|
|
19 |
|
|
# -- help
|
20 |
|
|
if [[ "$print_help" == "1" ]]; then
|
21 |
|
|
|
22 |
|
|
cat << "EOF"
|
23 |
|
|
Fixes permissions for http servers.b/polyfills as this is managed through composer.
|
24 |
|
|
Makes the installation bundle folder executable.
|
25 |
|
|
Sets the web-user as goup for ./modules and ./themes and as ownder and group for ./web
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
USAGE: fix-permissions.sh [--web-user USERNAME] [--admin-user USERNAME]
|
29 |
|
|
--web-user : The user under which the web server.
|
30 |
|
|
E.g. www-data in case of apache.
|
31 |
|
|
-h, --help : Print this help text
|
32 |
|
|
--admin-user : The user which is being used to manage the installation.
|
33 |
|
|
E.g. jenkins when the installation is managed by Jenkins CI
|
34 |
|
|
EOF
|
35 |
|
|
exit 0
|
36 |
|
|
fi
|
37 |
|
|
|
38 |
|
|
# -- tests
|
39 |
|
|
if [[ -z "$(grep 'cybertaxonomy.org/drupal-7-dataportal' composer.json)" ]]; then
|
40 |
|
|
echo "ERROR: This script must be executed in the root of the drupal-7-cdm-dataportal folder"
|
41 |
|
|
exit -1
|
42 |
|
|
fi
|
43 |
|
|
|
44 |
b84e63d6
|
Andreas Kohlbecker
|
echo "making root folder executable ..."
|
45 |
c2a36c08
|
Andreas Kohlbecker
|
chmod ugo+x ./
|
46 |
|
|
|
47 |
|
|
if [[ "$admin_user" ]]; then
|
48 |
b84e63d6
|
Andreas Kohlbecker
|
echo "$admin_user as owner of the installation package ..."
|
49 |
c2a36c08
|
Andreas Kohlbecker
|
chown -R $admin_user ./
|
50 |
|
|
fi
|
51 |
|
|
|
52 |
|
|
if [[ "$web_user" ]]; then
|
53 |
b84e63d6
|
Andreas Kohlbecker
|
echo "Permissions for the web-user $admin_user ..."
|
54 |
c2a36c08
|
Andreas Kohlbecker
|
chown -R $web_user:$web_user ./web
|
55 |
|
|
chown -R $web_user ./modules ./themes
|
56 |
|
|
fi
|
57 |
|
|
|
58 |
|
|
echo "DONE"
|