1.1 --- a/tools/fix.sh Wed Oct 21 00:27:36 2015 +0200
1.2 +++ b/tools/fix.sh Wed Oct 21 14:59:43 2015 +0200
1.3 @@ -1,28 +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_GROUP=lmtp
1.18 -DEFAULT_INSTALL_DIR=/var/lib/imip-agent
1.19 -DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent
1.20 -
1.21 if [ "$1" = "--help" ]; then
1.22 cat 1>&2 <<EOF
1.23 -Usage: $PROGNAME [ <user> [ <group> [ <stored data directory> [ <published data directory> ] ] ] ]
1.24 +Usage: $PROGNAME [ <stored data directory> [ <published data directory> [ <user> [ <group> ] ] ] ]
1.25
1.26 -Fix permissions for the stored and published data directories, using the given
1.27 -user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted),
1.28 -and operating on the given stored data and published data directories (or,
1.29 -respectively, $DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted).
1.30 +Fix permissions for the stored and published data directories, operating on the
1.31 +given stored data and published data directories (or, respectively,
1.32 +$INSTALL_DIR and $WEB_INSTALL_DIR if omitted).
1.33 +
1.34 +Set ownership and membership using the given user and group (or, respectively,
1.35 +$IMIP_AGENT_USER and $IMIP_AGENT_GROUP if omitted).
1.36 EOF
1.37 exit 1
1.38 fi
1.39
1.40 -USER=${1:-$DEFAULT_USER}
1.41 -GROUP=${2:-$DEFAULT_GROUP}
1.42 -INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR}
1.43 -WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR}
1.44 +INSTALL_DIR=${1:-$INSTALL_DIR}
1.45 +WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR}
1.46 +USER=${3:-$IMIP_AGENT_USER}
1.47 +GROUP=${4:-$IMIP_AGENT_GROUP}
1.48
1.49 chown -R "$USER" "$INSTALL_DIR"
1.50 chgrp -R "$GROUP" "$INSTALL_DIR"