Project

General

Profile

« Previous | Next » 

Revision c2a36c08

Added by Andreas Kohlbecker almost 3 years ago

admin script to fix permissions

View differences:

scripts/admin/fix-permissions.sh
1
#!/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
chmod ugo+x ./
45

  
46
if [[ "$admin_user" ]]; then
47
    chown -R $admin_user ./
48
fi
49

  
50
if [[ "$web_user" ]]; then
51
    chown -R $web_user:$web_user ./web
52
    chown -R $web_user ./modules ./themes
53
fi
54

  
55
echo "DONE"
56

  

Also available in: Unified diff