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