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