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> 18 19 Initialise a given calendar user within an existing installation, creating 20 resources within the given stored data and published data directories... 21 22 * $INSTALL_DIR 23 * $WEB_INSTALL_DIR 24 25 ...respectively. 26 27 The resources will be defined as having $IMIP_AGENT_USER as owner. 28 29 See $CONFIG for the settings used as described above. 30 EOF 31 exit 1 32 fi 33 34 CALENDAR_USER=$1 35 36 if [ ! "$CALENDAR_USER" ]; then 37 cat 1>&2 <<EOF 38 Need a calendar user to initialise. 39 EOF 40 exit 1 41 fi 42 43 # Initialise the directories. 44 45 for DIR in "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 46 mkdir -p "$DIR/$CALENDAR_USER" 47 chown "$IMIP_AGENT_USER" "$DIR/$CALENDAR_USER" 48 chmod g+ws "$DIR/$CALENDAR_USER" 49 # Group privileges should already be set. 50 done 51 52 if [ "$STORE_TYPE" = "file" ]; then 53 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/journal ; do 54 mkdir -p "$DIR/$CALENDAR_USER" 55 chown "$IMIP_AGENT_USER" "$DIR/$CALENDAR_USER" 56 chmod g+ws "$DIR/$CALENDAR_USER" 57 # Group privileges should already be set. 58 done 59 fi