imip-agent

tools/init_user.sh

1047:c06cdeae95a3
2016-02-08 Paul Boddie Added a test of booking two resources sharing a quota at the same time.
     1 #!/bin/sh     2      3 DIRNAME=`dirname $0`     4      5 if [ -e "$DIRNAME/config.sh" ]; then     6     . "$DIRNAME/config.sh"     7 else     8     . /etc/imip-agent/config.sh     9 fi    10     11 PROGNAME=`basename $0`    12     13 if [ "$1" = "--help" ]; then    14     cat 1>&2 <<EOF    15 Usage: $PROGNAME <calendar user> [ <stored data directory> [ <published data directory> [ <user> ] ] ]    16     17 Initialise a given calendar user within an existing installation, creating    18 resources within the given stored data and published data directories or,    19 respectively, within $INSTALL_DIR and $WEB_INSTALL_DIR.    20     21 The resources will be defined as having the given system user as owner or,    22 if the user is omitted, the $IMIP_AGENT_USER as owner.    23 EOF    24     exit 1    25 fi    26     27 CALENDAR_USER=$1    28 INSTALL_DIR=${2:-$INSTALL_DIR}    29 WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR}    30 USER=${4:-$IMIP_AGENT_USER}    31     32 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static \    33            "$INSTALL_DIR"/journal ; do    34     mkdir -p "$DIR/$CALENDAR_USER"    35     chown "$USER" "$DIR/$CALENDAR_USER"    36     chmod g+ws "$DIR/$CALENDAR_USER"    37     # Group privileges should already be set.    38 done