# HG changeset patch # User Paul Boddie # Date 1445432383 -7200 # Node ID e56b945e633a461356d1280275fdd59ee5d8ec10 # Parent f35f4ef71c0ff4a272d414fc9cfd321a6370aba4 Changed the tools' parameter ordering and added a configuration script included by the different tools. Tidied up and improved the documentation somewhat. diff -r f35f4ef71c0f -r e56b945e633a README.txt --- a/README.txt Wed Oct 21 00:27:36 2015 +0200 +++ b/README.txt Wed Oct 21 14:59:43 2015 +0200 @@ -74,9 +74,13 @@ useradd -d /var/lib/imip-agent -m -U -G www-data -r imip-agent Again, the tools/init.sh script will initialise directories for stored and -published data. For example: +published data. The tools/config.sh script should be edited and the group +redefined as follows: - tools/init.sh imip-agent www-data + IMIP_AGENT_GROUP=www-data + +If already installed, the /etc/imip-agent/config.sh script should be edited +instead. Installing the Software ======================= @@ -120,9 +124,12 @@ Such files need adjusting for the deployment environment so that, for example, the example.com domain would be replaced with a suitable value. -Where $lmtp_socket is employed, a suitable filesystem path is required; see +Where LMTP_SOCKET is employed, a suitable filesystem path is required; see below for a discussion of LMTP and mail delivery. +If local SMTP delivery is being used, the conf/postfix/master.cf.items file +will need adjusting to use the appropriate system group. + Configuring Mail Systems for Mail Recipients -------------------------------------------- diff -r f35f4ef71c0f -r e56b945e633a conf/exim/30_exim4-config_people --- a/conf/exim/30_exim4-config_people Wed Oct 21 00:27:36 2015 +0200 +++ b/conf/exim/30_exim4-config_people Wed Oct 21 14:59:43 2015 +0200 @@ -1,6 +1,6 @@ people_transport: debug_print = "T: people_transport for $local_part@$domain" driver = pipe - command = /var/lib/imip-agent/imip_person.py -l $lmtp_socket -o $pipe_addresses + command = /var/lib/imip-agent/imip_person.py -l LMTP_SOCKET -o $pipe_addresses user = imip-agent initgroups = true diff -r f35f4ef71c0f -r e56b945e633a conf/postfix/master.cf.items --- a/conf/postfix/master.cf.items Wed Oct 21 00:27:36 2015 +0200 +++ b/conf/postfix/master.cf.items Wed Oct 21 14:59:43 2015 +0200 @@ -2,9 +2,9 @@ imip_resources unix - n n - - pipe flags=FR user=imip-agent:lmtp argv=/var/lib/imip-agent/imip_resource.py -o ${original_recipient} -# Replace "-l $lmtp_socket" with "-L" for local SMTP delivery. +# Replace "-l LMTP_SOCKET" with "-L" for local SMTP delivery. imip_people unix - n n - - pipe flags=FR user=imip-agent:lmtp argv=/var/lib/imip-agent/imip_person.py - -o ${original_recipient} -l $lmtp_socket + -o ${original_recipient} -l LMTP_SOCKET imip_people_outgoing unix - n n - - pipe flags=FR user=imip-agent:lmtp argv=/var/lib/imip-agent/imip_person_outgoing.py diff -r f35f4ef71c0f -r e56b945e633a conf/postfix/transport --- a/conf/postfix/transport Wed Oct 21 00:27:36 2015 +0200 +++ b/conf/postfix/transport Wed Oct 21 14:59:43 2015 +0200 @@ -3,4 +3,4 @@ # iMIP content handling for example.com via the people address: people@example.com imip_people: # iMIP content handling for example.com via the people-outgoing address: -people-outgoing@example.com imip_people_outgoing: +people-outgoing@example.com imip_people_outgoing: diff -r f35f4ef71c0f -r e56b945e633a tools/config.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/config.sh Wed Oct 21 14:59:43 2015 +0200 @@ -0,0 +1,6 @@ +#!/bin/sh + +IMIP_AGENT_USER=imip-agent +IMIP_AGENT_GROUP=lmtp +INSTALL_DIR=/var/lib/imip-agent +WEB_INSTALL_DIR=/var/www/imip-agent diff -r f35f4ef71c0f -r e56b945e633a tools/fix.sh --- a/tools/fix.sh Wed Oct 21 00:27:36 2015 +0200 +++ b/tools/fix.sh Wed Oct 21 14:59:43 2015 +0200 @@ -1,28 +1,33 @@ #!/bin/sh +DIRNAME=`dirname $0` + +if [ -e "$DIRNAME/config.sh" ]; then + . "$DIRNAME/config.sh" +else + . /etc/imip-agent/config.sh +fi + PROGNAME=`basename $0` -DEFAULT_USER=imip-agent -DEFAULT_GROUP=lmtp -DEFAULT_INSTALL_DIR=/var/lib/imip-agent -DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent - if [ "$1" = "--help" ]; then cat 1>&2 < [ [ [ ] ] ] ] +Usage: $PROGNAME [ [ [ [ ] ] ] ] -Fix permissions for the stored and published data directories, using the given -user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted), -and operating on the given stored data and published data directories (or, -respectively, $DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted). +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). + +Set ownership and membership using the given user and group (or, respectively, +$IMIP_AGENT_USER and $IMIP_AGENT_GROUP if omitted). EOF exit 1 fi -USER=${1:-$DEFAULT_USER} -GROUP=${2:-$DEFAULT_GROUP} -INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR} -WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR} +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" diff -r f35f4ef71c0f -r e56b945e633a tools/init.sh --- a/tools/init.sh Wed Oct 21 00:27:36 2015 +0200 +++ b/tools/init.sh Wed Oct 21 14:59:43 2015 +0200 @@ -1,37 +1,43 @@ #!/bin/sh +DIRNAME=`dirname $0` + +if [ -e "$DIRNAME/config.sh" ]; then + . "$DIRNAME/config.sh" +else + . /etc/imip-agent/config.sh +fi + PROGNAME=`basename $0` -DEFAULT_USER=imip-agent -DEFAULT_GROUP=lmtp -DEFAULT_INSTALL_DIR=/var/lib/imip-agent -DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent - if [ "$1" = "--help" ]; then cat 1>&2 < [ [ [ ] ] ] ] +Usage: $PROGNAME [ [ [ [ ] ] ] ] -Initialise stored and published data directories with permissions set to the -given user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted), -and with the given stored data and published data directories (or, respectively, -$DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted). +Initialise stored and published data directories either at any specified +locations or, respectively, at $INSTALL_DIR and $WEB_INSTALL_DIR. + +Set permissions to the given user and group or, respectively, to $IMIP_AGENT_USER +and $IMIP_AGENT_GROUP. -Within the stored data directory, the following directories are created: +Within the stored data directory (using $INSTALL_DIR as an example), the +following directories are created: - * $DEFAULT_INSTALL_DIR/store - * $DEFAULT_INSTALL_DIR/preferences + * $INSTALL_DIR/store + * $INSTALL_DIR/preferences -Within the published data directory, the following directory is created: +Within the published data directory (using $WEB_INSTALL_DIR as an example), the +following directory is created: - * $DEFAULT_WEB_INSTALL_DIR/static + * $WEB_INSTALL_DIR/static EOF exit 1 fi -USER=${1:-$DEFAULT_USER} -GROUP=${2:-$DEFAULT_GROUP} -INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR} -WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR} +INSTALL_DIR=${1:-$INSTALL_DIR} +WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR} +USER=${3:-$IMIP_AGENT_USER} +GROUP=${4:-$IMIP_AGENT_GROUP} for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do mkdir -p "$DIR" diff -r f35f4ef71c0f -r e56b945e633a tools/init_user.sh --- a/tools/init_user.sh Wed Oct 21 00:27:36 2015 +0200 +++ b/tools/init_user.sh Wed Oct 21 14:59:43 2015 +0200 @@ -1,27 +1,33 @@ #!/bin/sh +DIRNAME=`dirname $0` + +if [ -e "$DIRNAME/config.sh" ]; then + . "$DIRNAME/config.sh" +else + . /etc/imip-agent/config.sh +fi + PROGNAME=`basename $0` -DEFAULT_USER=imip-agent -DEFAULT_INSTALL_DIR=/var/lib/imip-agent -DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent - if [ "$1" = "--help" ]; then cat 1>&2 < [ [ [ ] ] ] +Usage: $PROGNAME [ [ [ ] ] ] -Initialise a given calendar user within an existing installation, using the -given system user for ownership and the installation's stored data and published -data directories (or, respectively, $DEFAULT_USER, $DEFAULT_INSTALL_DIR and -$DEFAULT_WEB_INSTALL_DIR if omitted). +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. + +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. EOF exit 1 fi -CALENDAR_USER=${1:-$DEFAULT_CALENDAR_USER} -USER=${2:-$DEFAULT_USER} -INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR} -WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR} +CALENDAR_USER=$1 +INSTALL_DIR=${2:-$INSTALL_DIR} +WEB_INSTALL_DIR=${3:-$WEB_INSTALL_DIR} +USER=${4:-$IMIP_AGENT_USER} for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do mkdir -p "$DIR/$CALENDAR_USER" diff -r f35f4ef71c0f -r e56b945e633a tools/install.sh --- a/tools/install.sh Wed Oct 21 00:27:36 2015 +0200 +++ b/tools/install.sh Wed Oct 21 14:59:43 2015 +0200 @@ -16,9 +16,9 @@ if [ ! -e "$INSTALL_DIR/imiptools" ]; then mkdir "$INSTALL_DIR/imiptools" - if [ ! -e "$INSTALL_DIR/imiptools" ]; then - mkdir "$INSTALL_DIR/imiptools/handlers" - fi +fi +if [ ! -e "$INSTALL_DIR/imiptools/handlers" ]; then + mkdir "$INSTALL_DIR/imiptools/handlers" fi # Remove any symbolic link to the config module. @@ -44,11 +44,21 @@ fi fi +if [ -e "$CONFIG_DIR/config.sh" ]; then + if [ ! -e "$CONFIG_DIR/config.sh.backup" ]; then + mv "$CONFIG_DIR/config.sh" "$CONFIG_DIR/config.sh.backup" + fi +fi + # Replace the config module with a symbolic link. mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/" ln -s "$CONFIG_DIR/config.py" "$INSTALL_DIR/imiptools/config.py" +# Copy the config script. + +cp tools/config.sh "$CONFIG_DIR/" + # Tools TOOLS="fix.sh init.sh init_user.sh make_freebusy.py"