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 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 for DIR in "$INSTALL_DIR/imiptools" \ 30 "$INSTALL_DIR/imiptools/stores" \ 31 "$INSTALL_DIR/imiptools/handlers" \ 32 "$INSTALL_DIR/imiptools/handlers/scheduling" ; do 33 if [ ! -e "$DIR" ]; then 34 mkdir "$DIR" 35 fi 36 done 37 38 # Remove any symbolic link to the config module. 39 40 if [ -h "$INSTALL_DIR/imiptools/config.py" ]; then 41 rm "$INSTALL_DIR/imiptools/config.py" 42 fi 43 44 # Copy modules into the installation directory. 45 46 cp imiptools/*.py "$INSTALL_DIR/imiptools/" 47 cp imiptools/stores/*.py "$INSTALL_DIR/imiptools/stores/" 48 cp imiptools/handlers/*.py "$INSTALL_DIR/imiptools/handlers/" 49 cp imiptools/handlers/scheduling/*.py "$INSTALL_DIR/imiptools/handlers/scheduling/" 50 51 # Remove migrated modules. 52 53 if [ -e "$INSTALL_DIR/imiptools/handlers/scheduling.py" ]; then 54 rm "$INSTALL_DIR/imiptools/handlers/scheduling.py"* 55 fi 56 57 if [ -e "$INSTALL_DIR/imip_store.py" ]; then 58 rm "$INSTALL_DIR/imip_store.py"* 59 fi 60 61 # Install the config module in a more appropriate location. 62 # Create new versions of configuration files instead of overwriting. 63 64 if [ ! -e "$CONFIG_DIR" ]; then 65 mkdir -p "$CONFIG_DIR" 66 fi 67 68 if [ -e "$CONFIG_DIR/config.py" ]; then 69 mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py.new" 70 else 71 mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py" 72 fi 73 74 if [ -e "$CONFIG_DIR/config.sh" ]; then 75 cp "tools/config.sh" "$CONFIG_DIR/config.sh.new" 76 else 77 cp "tools/config.sh" "$CONFIG_DIR/config.sh" 78 fi 79 80 # Replace the config module with a symbolic link. 81 82 ln -s "$CONFIG_DIR/config.py" "$INSTALL_DIR/imiptools/config.py" 83 84 # Tools 85 86 TOOLS="fix.sh init.sh init_user.sh make_freebusy.py update_quotas.py update_scheduling_modules.py" 87 88 if [ ! -e "$INSTALL_DIR/tools" ]; then 89 mkdir -p "$INSTALL_DIR/tools" 90 fi 91 92 for TOOL in $TOOLS; do 93 cp "tools/$TOOL" "$INSTALL_DIR/tools/" 94 done 95 96 # Web manager interface. 97 98 if [ ! -e "$WEB_INSTALL_DIR" ]; then 99 mkdir -p "$WEB_INSTALL_DIR" 100 fi 101 102 cp imip_manager.py "$WEB_INSTALL_DIR" 103 cp htdocs/styles.css "$WEB_INSTALL_DIR" 104 105 if [ ! -e "$WEB_INSTALL_DIR/imipweb" ]; then 106 mkdir "$WEB_INSTALL_DIR/imipweb" 107 fi 108 109 cp imipweb/*.py "$WEB_INSTALL_DIR/imipweb/" 110 111 # Locale directory. 112 113 if [ ! "$NO_LOCALE_DIR" ] && [ -e "locale" ]; then 114 for DIR in "locale/"*"/LC_MESSAGES" ; do 115 mkdir -p "$INSTALL_DIR/$DIR" 116 cp "$DIR/"*.mo "$INSTALL_DIR/$DIR/" 117 done 118 fi 119 120 # Run the scheduling module update tool to regenerate the manifest module. 121 122 PYTHONPATH="$INSTALL_DIR" "$INSTALL_DIR/tools/update_scheduling_modules.py"