imip-agent

Annotated tools/init_user.sh

1039:a12150034cbd
2016-02-08 Paul Boddie Added a journal storage area, maintaining quota and collective scheduling data for scheduling decisions. Introduced confirmation and retraction functions for resource scheduling so that quotas and collective schedules can be maintained and thus queried by scheduling functions. Updated the documentation, tools and tests.
paul@752 1
#!/bin/sh
paul@752 2
paul@891 3
DIRNAME=`dirname $0`
paul@891 4
paul@891 5
if [ -e "$DIRNAME/config.sh" ]; then
paul@891 6
    . "$DIRNAME/config.sh"
paul@891 7
else
paul@891 8
    . /etc/imip-agent/config.sh
paul@891 9
fi
paul@891 10
paul@752 11
PROGNAME=`basename $0`
paul@752 12
paul@752 13
if [ "$1" = "--help" ]; then
paul@752 14
    cat 1>&2 <<EOF
paul@891 15
Usage: $PROGNAME <calendar user> [ <stored data directory> [ <published data directory> [ <user> ] ] ]
paul@752 16
paul@891 17
Initialise a given calendar user within an existing installation, creating
paul@891 18
resources within the given stored data and published data directories or,
paul@891 19
respectively, within $INSTALL_DIR and $WEB_INSTALL_DIR.
paul@891 20
paul@891 21
The resources will be defined as having the given system user as owner or,
paul@891 22
if the user is omitted, the $IMIP_AGENT_USER as owner.
paul@752 23
EOF
paul@752 24
    exit 1
paul@752 25
fi
paul@752 26
paul@891 27
CALENDAR_USER=$1
paul@891 28
INSTALL_DIR=${2:-$INSTALL_DIR}
paul@891 29
WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR}
paul@891 30
USER=${4:-$IMIP_AGENT_USER}
paul@752 31
paul@1039 32
for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static \
paul@1039 33
           "$INSTALL_DIR"/journal ; do
paul@752 34
    mkdir -p "$DIR/$CALENDAR_USER"
paul@752 35
    chown "$USER" "$DIR/$CALENDAR_USER"
paul@752 36
    chmod g+ws "$DIR/$CALENDAR_USER"
paul@752 37
    # Group privileges should already be set.
paul@752 38
done