imip-agent

tools/init_user.sh

1038:ed312d199bb7
2016-02-07 Paul Boddie Added support for duration formatting.
     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 ; do    33     mkdir -p "$DIR/$CALENDAR_USER"    34     chown "$USER" "$DIR/$CALENDAR_USER"    35     chmod g+ws "$DIR/$CALENDAR_USER"    36     # Group privileges should already be set.    37 done