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 | Initialise stored and published data directories either at any specified |
paul@891 | 18 | locations or, respectively, at $INSTALL_DIR and $WEB_INSTALL_DIR. |
paul@891 | 19 | |
paul@891 | 20 | Set permissions to the given user and group or, respectively, to $IMIP_AGENT_USER |
paul@891 | 21 | and $IMIP_AGENT_GROUP. |
paul@731 | 22 | |
paul@891 | 23 | Within the stored data directory (using $INSTALL_DIR as an example), the |
paul@891 | 24 | following directories are created: |
paul@731 | 25 | |
paul@1039 | 26 | * $INSTALL_DIR/journal |
paul@1039 | 27 | * $INSTALL_DIR/preferences |
paul@891 | 28 | * $INSTALL_DIR/store |
paul@731 | 29 | |
paul@891 | 30 | Within the published data directory (using $WEB_INSTALL_DIR as an example), the |
paul@891 | 31 | following directory is created: |
paul@731 | 32 | |
paul@891 | 33 | * $WEB_INSTALL_DIR/static |
paul@731 | 34 | EOF |
paul@731 | 35 | exit 1 |
paul@731 | 36 | fi |
paul@731 | 37 | |
paul@891 | 38 | INSTALL_DIR=${1:-$INSTALL_DIR} |
paul@891 | 39 | WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR} |
paul@891 | 40 | USER=${3:-$IMIP_AGENT_USER} |
paul@891 | 41 | GROUP=${4:-$IMIP_AGENT_GROUP} |
paul@634 | 42 | |
paul@1039 | 43 | for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static \ |
paul@1039 | 44 | "$INSTALL_DIR"/journal ; do |
paul@634 | 45 | mkdir -p "$DIR" |
paul@634 | 46 | chown "$USER" "$DIR" |
paul@634 | 47 | chgrp "$GROUP" "$DIR" |
paul@634 | 48 | chmod g+ws "$DIR" |
paul@634 | 49 | done |