imip-agent

tools/fix.sh

1046:84c6d38d2c9a
2016-02-08 Paul Boddie Support the more flexible text format for the groups and limits files.
     1 #!/bin/sh     2      3 DIRNAME=`dirname $0`     4      5 if [ -e "$DIRNAME/config.sh" ]; then     6     . "$DIRNAME/config.sh"     7 else     8     . /etc/imip-agent/config.sh     9 fi    10     11 PROGNAME=`basename $0`    12     13 if [ "$1" = "--help" ]; then    14     cat 1>&2 <<EOF    15 Usage: $PROGNAME [ <stored data directory> [ <published data directory> [ <user> [ <group> ] ] ] ]    16     17 Fix permissions for the stored and published data directories, operating on the    18 given stored data and published data directories (or, respectively,    19 $INSTALL_DIR and $WEB_INSTALL_DIR if omitted).    20     21 Set ownership and membership using the given user and group (or, respectively,    22 $IMIP_AGENT_USER and $IMIP_AGENT_GROUP if omitted).    23 EOF    24     exit 1    25 fi    26     27 INSTALL_DIR=${1:-$INSTALL_DIR}    28 WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR}    29 USER=${3:-$IMIP_AGENT_USER}    30 GROUP=${4:-$IMIP_AGENT_GROUP}    31     32 chown -R "$USER" "$INSTALL_DIR"    33 chgrp -R "$GROUP" "$INSTALL_DIR"    34     35 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static \    36            "$INSTALL_DIR"/journal ; do    37     chown -R "$USER" "$DIR"    38     chgrp -R "$GROUP" "$DIR"    39     chmod -R g+w "$DIR"    40 done