Added a script to set file and directories permissions automatically.
authormj <mj>
Tue, 2 Oct 2001 10:11:05 +0000 (10:11 +0000)
committermj <mj>
Tue, 2 Oct 2001 10:11:05 +0000 (10:11 +0000)
Added some lines to the configuration

doc/INSTALL.mir
perms.sh-dist [new file with mode: 0755]

index d74d5ec..989d14c 100755 (executable)
@@ -65,7 +65,15 @@ as user postgres:
        There, read INSTALL and follow the instructions.
        
 
-10. chmod 777 Mir/log 
+10. Set permissions
+       We provide a script that sets all files' and direcories' permissions to
+       a quite reasonable state.
+       
+       cp perms.sh-dist perms.sh
+       # Now, change the install directory and group in perms.sh
+       edit perms.sh 
+       ./perms.sh
+
 
 11. restart tomcat 
 
diff --git a/perms.sh-dist b/perms.sh-dist
new file mode 100755 (executable)
index 0000000..04a376c
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Where the installed system resides
+INSTDIR=../Mir
+
+# The group all files belong to
+GROUP=www-data
+
+
+# No config required after this point. Hopefully.
+##################################################################
+
+# Needed to correct permissions
+
+function chm()
+{
+       # Parameters. $1 permissions
+       #                         $2 directory or file
+       #                         $3 mode: [d|f] (dir or file)
+
+       LIST=$(find $2 -type $3) 
+       if [ "$LIST" != "" ]; then
+               echo "$LIST"
+               chmod $1 $LIST
+       fi
+}
+
+function grant()
+{
+       # Parameters: $1: permissions for dirs
+       #                         $2: permissions for files
+       #             $3: directory or file
+
+       chmod $1 $3
+    UMASK=$(umask)
+       umask 044
+#      chmod $1 $(find $3 -type d) 
+#      chmod $2 $(find $3 -type f) 
+       chm $1 $3 d 
+       chm $2 $3 f
+       umask $UMASK
+}
+
+chgrp $GROUP $INSTDIR -R > /dev/null 2>&1
+grant 775 664 $INSTDIR > /dev/null 2>&1
+grant 750 640 $INSTDIR/WEB-INF/classes/config.properties
+grant 740 640 $INSTDIR/src/config.properties
+#grant 755 644 $INSTDIR/templates
+#grant 755 644 $INSTDIR/produced