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