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