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 if ! cmp "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py" > /dev/null 2>&1 ; then 72 mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py.new" 73 fi 74 else 75 mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py" 76 fi 77 78 if [ -e "$CONFIG_DIR/config.sh" ]; then 79 if ! cmp "tools/config.sh" "$CONFIG_DIR/config.sh" > /dev/null 2>&1 ; then 80 cp "tools/config.sh" "$CONFIG_DIR/config.sh.new" 81 fi 82 else 83 cp "tools/config.sh" "$CONFIG_DIR/config.sh" 84 fi 85 86 # Replace the config module with a symbolic link. 87 88 ln -s "$CONFIG_DIR/config.py" "$INSTALL_DIR/imiptools/config.py" 89 90 # Copy related configuration files. 91 92 if [ ! -e "$CONFIG_DIR/postgresql" ]; then 93 mkdir -p "$CONFIG_DIR/postgresql" 94 fi 95 96 if [ -e "$CONFIG_DIR/postgresql/schema.sql" ]; then 97 if ! cmp "conf/postgresql/schema.sql" "$CONFIG_DIR/postgresql/schema.sql" > /dev/null 2>&1 ; then 98 cp "conf/postgresql/schema.sql" "$CONFIG_DIR/postgresql/schema.sql.new" 99 fi 100 else 101 cp "conf/postgresql/schema.sql" "$CONFIG_DIR/postgresql/schema.sql" 102 fi 103 104 # Tools 105 106 TOOLS="copy_store.py fix.sh init.sh init_user.sh make_freebusy.py set_quota_limit.py update_quotas.py update_scheduling_modules.py" 107 108 if [ ! -e "$INSTALL_DIR/tools" ]; then 109 mkdir -p "$INSTALL_DIR/tools" 110 fi 111 112 for TOOL in $TOOLS; do 113 cp "tools/$TOOL" "$INSTALL_DIR/tools/" 114 done 115 116 # Web manager interface. 117 118 if [ ! -e "$WEB_INSTALL_DIR" ]; then 119 mkdir -p "$WEB_INSTALL_DIR" 120 fi 121 122 cp imip_manager.py "$WEB_INSTALL_DIR" 123 cp htdocs/styles.css "$WEB_INSTALL_DIR" 124 125 if [ ! -e "$WEB_INSTALL_DIR/imipweb" ]; then 126 mkdir "$WEB_INSTALL_DIR/imipweb" 127 fi 128 129 cp imipweb/*.py "$WEB_INSTALL_DIR/imipweb/" 130 131 # Locale directory. 132 133 if [ ! "$NO_LOCALE_DIR" ] && [ -e "locale" ]; then 134 for DIR in "locale/"*"/LC_MESSAGES" ; do 135 mkdir -p "$INSTALL_DIR/$DIR" 136 cp "$DIR/"*.mo "$INSTALL_DIR/$DIR/" 137 done 138 fi 139 140 # Run the scheduling module update tool to regenerate the manifest module. 141 142 PYTHONPATH="$INSTALL_DIR" "$INSTALL_DIR/tools/update_scheduling_modules.py"