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