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