*** empty log message ***
[mir.git] / perms.sh-dist
1 #!/bin/sh
2
3 # Where the installed system resides
4 INSTDIR=`dirname $0`/bin/mir
5
6 # The group all files belong to
7 GROUP=www-data
8
9
10 # No config required after this point. Hopefully.
11 ##################################################################
12
13 # Needed to correct permissions
14
15 function chm()
16 {
17         # Parameters. $1 permissions
18         #                         $2 directory or file
19         #                         $3 mode: [d|f] (dir or file)
20
21         LIST=$(find $2 -type $3) 
22         if [ "$LIST" != "" ]; then
23                 echo "$LIST"
24                 chmod $1 $LIST
25         fi
26 }
27
28 function grant()
29 {
30         # Parameters: $1: permissions for dirs
31         #                         $2: permissions for files
32         #             $3: directory or file
33
34         chmod $1 $3
35     UMASK=$(umask)
36         umask 044
37 #       chmod $1 $(find $3 -type d) 
38 #       chmod $2 $(find $3 -type f) 
39         chm $1 $3 d 
40         chm $2 $3 f
41         umask $UMASK
42 }
43
44 chgrp $GROUP $INSTDIR -R #> /dev/null 2>&1
45 grant 775 664 $INSTDIR > /dev/null 2>&1
46 grant 750 640 $INSTDIR/WEB-INF/etc/config.properties
47
48 echo "Permissions set."