1 #!/bin/sh 2 3 PROGNAME=`basename $0` 4 5 DEFAULT_USER=imip-agent 6 DEFAULT_INSTALL_DIR=/var/lib/imip-agent 7 DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent 8 9 if [ "$1" = "--help" ]; then 10 cat 1>&2 <<EOF 11 Usage: $PROGNAME <calendar user> [ <user> [ <stored data directory> [ <published data directory> ] ] ] 12 13 Initialise a given calendar user within an existing installation, using the 14 given system user for ownership and the installation's stored data and published 15 data directories (or, respectively, $DEFAULT_USER, $DEFAULT_INSTALL_DIR and 16 $DEFAULT_WEB_INSTALL_DIR if omitted). 17 EOF 18 exit 1 19 fi 20 21 CALENDAR_USER=${1:-$DEFAULT_CALENDAR_USER} 22 USER=${2:-$DEFAULT_USER} 23 INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR} 24 WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR} 25 26 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do 27 mkdir -p "$DIR/$CALENDAR_USER" 28 chown "$USER" "$DIR/$CALENDAR_USER" 29 chmod g+ws "$DIR/$CALENDAR_USER" 30 # Group privileges should already be set. 31 done