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