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 <calendar user> [ <stored data directory> [ <published data directory> [ <user> ] ] ] 18 19 Initialise a given calendar user within an existing installation, creating 20 resources within the given stored data and published data directories or, 21 respectively, within $INSTALL_DIR and $WEB_INSTALL_DIR. 22 23 The resources will be defined as having the given system user as owner or, 24 if the user is omitted, the $IMIP_AGENT_USER as owner. 25 EOF 26 exit 1 27 fi 28 29 CALENDAR_USER=$1 30 INSTALL_DIR=${2:-$INSTALL_DIR} 31 WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR} 32 USER=${4:-$IMIP_AGENT_USER} 33 34 for DIR in "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 35 mkdir -p "$DIR/$CALENDAR_USER" 36 chown "$USER" "$DIR/$CALENDAR_USER" 37 chmod g+ws "$DIR/$CALENDAR_USER" 38 # Group privileges should already be set. 39 done 40 41 if [ "$STORE_TYPE" = "file" ]; then 42 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/journal ; do 43 mkdir -p "$DIR/$CALENDAR_USER" 44 chown "$USER" "$DIR/$CALENDAR_USER" 45 chmod g+ws "$DIR/$CALENDAR_USER" 46 # Group privileges should already be set. 47 done 48 fi