# HG changeset patch # User Paul Boddie # Date 1459712615 -7200 # Node ID fd4ecfe8b0a5dc247eae5aa5eeb3a6131ab52b71 # Parent ac93d058c7468b7985059f9567e823119d4444c5 Removed command line overrides; added database, user and schema initialisation. Updated the installation script to install schema details. diff -r ac93d058c746 -r fd4ecfe8b0a5 tools/config.sh --- a/tools/config.sh Sun Apr 03 21:41:44 2016 +0200 +++ b/tools/config.sh Sun Apr 03 21:43:35 2016 +0200 @@ -6,3 +6,10 @@ INSTALL_DIR=/var/lib/imip-agent WEB_INSTALL_DIR=/var/www/imip-agent CONFIG_DIR=/etc/imip-agent + +# Store-specific settings. + +# For STORE_TYPE=postgresql: + +POSTGRESQL_DB=imip_agent +POSTGRESQL_USERS="imip-agent www-data" diff -r ac93d058c746 -r fd4ecfe8b0a5 tools/fix.sh --- a/tools/fix.sh Sun Apr 03 21:41:44 2016 +0200 +++ b/tools/fix.sh Sun Apr 03 21:43:35 2016 +0200 @@ -14,36 +14,34 @@ if [ "$1" = "--help" ]; then cat 1>&2 < [ [ [ ] ] ] ] +Usage: $PROGNAME + +Fix permissions for the stored and published data directories, operating on... -Fix permissions for the stored and published data directories, operating on the -given stored data and published data directories (or, respectively, -$INSTALL_DIR and $WEB_INSTALL_DIR if omitted). + * $INSTALL_DIR + * $WEB_INSTALL_DIR -Set ownership and membership using the given user and group (or, respectively, -$IMIP_AGENT_USER and $IMIP_AGENT_GROUP if omitted). +...respectively. + +Set ownership and membership to the user and group respectively given as +$IMIP_AGENT_USER and $IMIP_AGENT_GROUP. EOF exit 1 fi -INSTALL_DIR=${1:-$INSTALL_DIR} -WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR} -USER=${3:-$IMIP_AGENT_USER} -GROUP=${4:-$IMIP_AGENT_GROUP} - -chown -R "$USER" "$INSTALL_DIR" -chgrp -R "$GROUP" "$INSTALL_DIR" +chown -R "$IMIP_AGENT_USER" "$INSTALL_DIR" +chgrp -R "$IMIP_AGENT_GROUP" "$INSTALL_DIR" for DIR in "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do - chown -R "$USER" "$DIR" - chgrp -R "$GROUP" "$DIR" + chown -R "$IMIP_AGENT_USER" "$DIR" + chgrp -R "$IMIP_AGENT_GROUP" "$DIR" chmod -R g+w "$DIR" done if [ "$STORE_TYPE" = "file" ]; then for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/journal ; do - chown -R "$USER" "$DIR" - chgrp -R "$GROUP" "$DIR" + chown -R "$IMIP_AGENT_USER" "$DIR" + chgrp -R "$IMIP_AGENT_GROUP" "$DIR" chmod -R g+w "$DIR" done fi diff -r ac93d058c746 -r fd4ecfe8b0a5 tools/init.sh --- a/tools/init.sh Sun Apr 03 21:41:44 2016 +0200 +++ b/tools/init.sh Sun Apr 03 21:43:35 2016 +0200 @@ -1,61 +1,139 @@ #!/bin/sh DIRNAME=`dirname $0` +CONFIG="$DIRNAME/config.sh" -if [ -e "$DIRNAME/config.sh" ]; then - CONFIG="$DIRNAME/config.sh" +if [ -e "$CONFIG" ]; then . "$CONFIG" else CONFIG=/etc/imip-agent/config.sh . "$CONFIG" fi +SCHEMA="$DIRNAME/../conf/postgresql/schema.sql" + +if [ ! -e "$SCHEMA" ]; then + SCHEMA=/etc/imip-agent/postgresql/schema.sql +fi + PROGNAME=`basename $0` if [ "$1" = "--help" ]; then cat 1>&2 < [ [ [ ] ] ] ] +Usage: $PROGNAME + +Initialise stored and published data directories at... -Initialise stored and published data directories either at any specified -locations or, respectively, at $INSTALL_DIR and $WEB_INSTALL_DIR. + * $INSTALL_DIR + * $WEB_INSTALL_DIR -Set permissions to the given user and group or, respectively, to $IMIP_AGENT_USER +...respectively. + +Set permissions to the user and group respectively given as $IMIP_AGENT_USER and $IMIP_AGENT_GROUP. -Within the stored data directory (using $INSTALL_DIR as an example), the -following directories are created: +Within the stored data directory, the following directories will be created +(with STORE_TYPE currently set as "$STORE_TYPE"): - * $INSTALL_DIR/journal (if STORE_TYPE is "file") * $INSTALL_DIR/preferences - * $INSTALL_DIR/store (if STORE_TYPE is "file") +EOF -Within the published data directory (using $WEB_INSTALL_DIR as an example), the -following directory is created: + if [ "$STORE_TYPE" = "file" ]; then + cat 1>&2 <&2 <&2 <&2 <&2 <&2 <&2 <&2 <&2 <&2 < [ [ [ ] ] ] +Usage: $PROGNAME Initialise a given calendar user within an existing installation, creating -resources within the given stored data and published data directories or, -respectively, within $INSTALL_DIR and $WEB_INSTALL_DIR. +resources within the given stored data and published data directories... + + * $INSTALL_DIR + * $WEB_INSTALL_DIR -The resources will be defined as having the given system user as owner or, -if the user is omitted, the $IMIP_AGENT_USER as owner. +...respectively. + +The resources will be defined as having $IMIP_AGENT_USER as owner. + +See $CONFIG for the settings used as described above. EOF exit 1 fi CALENDAR_USER=$1 -INSTALL_DIR=${2:-$INSTALL_DIR} -WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR} -USER=${4:-$IMIP_AGENT_USER} + +if [ ! "$CALENDAR_USER" ]; then + cat 1>&2 <