imip-agent

Annotated tools/install.sh

871:b38466ae1e51
2015-10-18 Paul Boddie Handle rule-based occurrences as exceptions when removed by attendees for counter-proposals.
paul@102 1
#!/bin/sh
paul@102 2
paul@670 3
# Agents and modules.
paul@670 4
paul@102 5
AGENTS="imip_person.py imip_person_outgoing.py imip_resource.py"
paul@102 6
MODULES="markup.py imip_store.py vCalendar.py vContent.py vRecurrence.py"
paul@102 7
INSTALL_DIR=/var/lib/imip-agent
paul@671 8
CONFIG_DIR=/etc/imip-agent
paul@102 9
paul@102 10
if [ ! -e "$INSTALL_DIR" ]; then
paul@102 11
    mkdir -p "$INSTALL_DIR"
paul@102 12
fi
paul@102 13
paul@102 14
cp $AGENTS "$INSTALL_DIR"
paul@102 15
cp $MODULES "$INSTALL_DIR"
paul@440 16
paul@440 17
if [ ! -e "$INSTALL_DIR/imiptools" ]; then
paul@668 18
    mkdir "$INSTALL_DIR/imiptools"
paul@440 19
    if [ ! -e "$INSTALL_DIR/imiptools" ]; then
paul@668 20
        mkdir "$INSTALL_DIR/imiptools/handlers"
paul@440 21
    fi
paul@440 22
fi
paul@440 23
paul@671 24
# Remove any symbolic link to the config module.
paul@671 25
paul@671 26
if [ -h "$INSTALL_DIR/imiptools/config.py" ]; then
paul@671 27
    rm "$INSTALL_DIR/imiptools/config.py"
paul@671 28
fi
paul@671 29
paul@671 30
# Copy modules into the installation directory.
paul@671 31
paul@671 32
cp imiptools/*.py "$INSTALL_DIR/imiptools/"
paul@671 33
cp imiptools/handlers/*.py "$INSTALL_DIR/imiptools/handlers/"
paul@671 34
paul@671 35
# Install the config module in a more appropriate location.
paul@671 36
paul@671 37
if [ ! -e "$CONFIG_DIR" ]; then
paul@671 38
    mkdir -p "$CONFIG_DIR"
paul@671 39
fi
paul@671 40
paul@671 41
if [ -e "$CONFIG_DIR/config.py" ]; then
paul@671 42
    if [ ! -e "$CONFIG_DIR/config.py.backup" ]; then
paul@671 43
        mv "$CONFIG_DIR/config.py" "$CONFIG_DIR/config.py.backup"
paul@668 44
    fi
paul@668 45
fi
paul@668 46
paul@671 47
# Replace the config module with a symbolic link.
paul@671 48
paul@671 49
mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/"
paul@671 50
ln -s "$CONFIG_DIR/config.py" "$INSTALL_DIR/imiptools/config.py"
paul@102 51
paul@670 52
# Tools
paul@670 53
paul@752 54
TOOLS="fix.sh init.sh init_user.sh make_freebusy.py"
paul@752 55
paul@670 56
if [ ! -e "$INSTALL_DIR/tools" ]; then
paul@670 57
    mkdir -p "$INSTALL_DIR/tools"
paul@670 58
fi
paul@670 59
paul@752 60
for TOOL in $TOOLS; do
paul@752 61
    cp "tools/$TOOL" "$INSTALL_DIR/tools/"
paul@752 62
done
paul@670 63
paul@670 64
# Web manager interface.
paul@670 65
paul@670 66
WEB_INSTALL_DIR=/var/www/imip-agent
paul@670 67
paul@102 68
if [ ! -e "$WEB_INSTALL_DIR" ]; then
paul@102 69
    mkdir -p "$WEB_INSTALL_DIR"
paul@102 70
fi
paul@102 71
paul@102 72
cp imip_manager.py "$WEB_INSTALL_DIR"
paul@188 73
cp htdocs/styles.css "$WEB_INSTALL_DIR"
paul@440 74
paul@440 75
if [ ! -e "$WEB_INSTALL_DIR/imipweb" ]; then
paul@668 76
    mkdir "$WEB_INSTALL_DIR/imipweb"
paul@440 77
fi
paul@440 78
paul@668 79
cp imipweb/*.py "$WEB_INSTALL_DIR/imipweb/"