1 #!/bin/sh 2 3 DIRNAME=`dirname $0` 4 5 if [ -e "$DIRNAME/config.sh" ]; then 6 CONFIG="$DIRNAME/config.sh" 7 . "$CONFIG" 8 else 9 CONFIG=/etc/imip-agent/config.sh 10 . "$CONFIG" 11 fi 12 13 PROGNAME=`basename $0` 14 15 if [ "$1" = "--help" ]; then 16 cat 1>&2 <<EOF 17 Usage: $PROGNAME [ <stored data directory> [ <published data directory> [ <user> [ <group> ] ] ] ] 18 19 Fix permissions for the stored and published data directories, operating on the 20 given stored data and published data directories (or, respectively, 21 $INSTALL_DIR and $WEB_INSTALL_DIR if omitted). 22 23 Set ownership and membership using the given user and group (or, respectively, 24 $IMIP_AGENT_USER and $IMIP_AGENT_GROUP if omitted). 25 EOF 26 exit 1 27 fi 28 29 INSTALL_DIR=${1:-$INSTALL_DIR} 30 WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR} 31 USER=${3:-$IMIP_AGENT_USER} 32 GROUP=${4:-$IMIP_AGENT_GROUP} 33 34 chown -R "$USER" "$INSTALL_DIR" 35 chgrp -R "$GROUP" "$INSTALL_DIR" 36 37 for DIR in "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 38 chown -R "$USER" "$DIR" 39 chgrp -R "$GROUP" "$DIR" 40 chmod -R g+w "$DIR" 41 done 42 43 if [ "$STORE_TYPE" = "file" ]; then 44 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/journal ; do 45 chown -R "$USER" "$DIR" 46 chgrp -R "$GROUP" "$DIR" 47 chmod -R g+w "$DIR" 48 done 49 fi