From: pietrus Date: Wed, 23 Aug 2006 00:22:22 +0000 (+0000) Subject: script to fix permissions of files and dirs in the binary distribuition X-Git-Tag: LATEST_MERGED_1_1~48 X-Git-Url: http://erislabs.net/gitweb/?p=mir.git;a=commitdiff_plain;h=fd3ab8417af7c1b7ef8eeb03f1538fc2f8c6ed6f script to fix permissions of files and dirs in the binary distribuition --- diff --git a/web/WEB-INF/perms.sh-dist b/web/WEB-INF/perms.sh-dist new file mode 100644 index 00000000..3c312aff --- /dev/null +++ b/web/WEB-INF/perms.sh-dist @@ -0,0 +1,48 @@ +#!/bin/sh + +# Where the installed system resides +INSTDIR=`dirname $0` + +# 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 etc/config.properties + +echo "Permissions set."