1 #!/bin/sh 2 3 PROGNAME=`basename $0` 4 5 DEFAULT_USER=imip-agent 6 DEFAULT_GROUP=lmtp 7 DEFAULT_INSTALL_DIR=/var/lib/imip-agent 8 DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent 9 10 if [ "$1" = "--help" ]; then 11 cat 1>&2 <<EOF 12 Usage: $PROGNAME [ <user> [ <group> [ <stored data directory> [ <published data directory> ] ] ] ] 13 14 Fix permissions for the stored and published data directories, using the given 15 user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted), 16 and operating on the given stored data and published data directories (or, 17 respectively, $DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted). 18 EOF 19 exit 1 20 fi 21 22 USER=${1:-$DEFAULT_USER} 23 GROUP=${2:-$DEFAULT_GROUP} 24 INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR} 25 WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR} 26 27 chown -R "$USER" "$INSTALL_DIR" 28 chgrp -R "$GROUP" "$INSTALL_DIR" 29 30 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 31 chown -R "$USER" "$DIR" 32 chgrp -R "$GROUP" "$DIR" 33 chmod -R g+w "$DIR" 34 done