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 Initialise stored and published data directories either at any specified 20 locations or, respectively, at $INSTALL_DIR and $WEB_INSTALL_DIR. 21 22 Set permissions to the given user and group or, respectively, to $IMIP_AGENT_USER 23 and $IMIP_AGENT_GROUP. 24 25 Within the stored data directory (using $INSTALL_DIR as an example), the 26 following directories are created: 27 28 * $INSTALL_DIR/journal (if STORE_TYPE is "file") 29 * $INSTALL_DIR/preferences 30 * $INSTALL_DIR/store (if STORE_TYPE is "file") 31 32 Within the published data directory (using $WEB_INSTALL_DIR as an example), the 33 following directory is created: 34 35 * $WEB_INSTALL_DIR/static 36 37 See $CONFIG for the STORE_TYPE setting. 38 EOF 39 exit 1 40 fi 41 42 INSTALL_DIR=${1:-$INSTALL_DIR} 43 WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR} 44 USER=${3:-$IMIP_AGENT_USER} 45 GROUP=${4:-$IMIP_AGENT_GROUP} 46 47 for DIR in "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 48 mkdir -p "$DIR" 49 chown "$USER" "$DIR" 50 chgrp "$GROUP" "$DIR" 51 chmod g+ws "$DIR" 52 done 53 54 if [ "$STORE_TYPE" = "file" ]; then 55 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/journal ; do 56 mkdir -p "$DIR" 57 chown "$USER" "$DIR" 58 chgrp "$GROUP" "$DIR" 59 chmod g+ws "$DIR" 60 done 61 fi