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