1.1 --- a/tools/init_user.sh Wed Oct 21 00:27:36 2015 +0200
1.2 +++ b/tools/init_user.sh Wed Oct 21 14:59:43 2015 +0200
1.3 @@ -1,27 +1,33 @@
1.4 #!/bin/sh
1.5
1.6 +DIRNAME=`dirname $0`
1.7 +
1.8 +if [ -e "$DIRNAME/config.sh" ]; then
1.9 + . "$DIRNAME/config.sh"
1.10 +else
1.11 + . /etc/imip-agent/config.sh
1.12 +fi
1.13 +
1.14 PROGNAME=`basename $0`
1.15
1.16 -DEFAULT_USER=imip-agent
1.17 -DEFAULT_INSTALL_DIR=/var/lib/imip-agent
1.18 -DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent
1.19 -
1.20 if [ "$1" = "--help" ]; then
1.21 cat 1>&2 <<EOF
1.22 -Usage: $PROGNAME <calendar user> [ <user> [ <stored data directory> [ <published data directory> ] ] ]
1.23 +Usage: $PROGNAME <calendar user> [ <stored data directory> [ <published data directory> [ <user> ] ] ]
1.24
1.25 -Initialise a given calendar user within an existing installation, using the
1.26 -given system user for ownership and the installation's stored data and published
1.27 -data directories (or, respectively, $DEFAULT_USER, $DEFAULT_INSTALL_DIR and
1.28 -$DEFAULT_WEB_INSTALL_DIR if omitted).
1.29 +Initialise a given calendar user within an existing installation, creating
1.30 +resources within the given stored data and published data directories or,
1.31 +respectively, within $INSTALL_DIR and $WEB_INSTALL_DIR.
1.32 +
1.33 +The resources will be defined as having the given system user as owner or,
1.34 +if the user is omitted, the $IMIP_AGENT_USER as owner.
1.35 EOF
1.36 exit 1
1.37 fi
1.38
1.39 -CALENDAR_USER=${1:-$DEFAULT_CALENDAR_USER}
1.40 -USER=${2:-$DEFAULT_USER}
1.41 -INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR}
1.42 -WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR}
1.43 +CALENDAR_USER=$1
1.44 +INSTALL_DIR=${2:-$INSTALL_DIR}
1.45 +WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR}
1.46 +USER=${4:-$IMIP_AGENT_USER}
1.47
1.48 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do
1.49 mkdir -p "$DIR/$CALENDAR_USER"