paul@102 | 1 | #!/bin/sh |
paul@102 | 2 | |
paul@1108 | 3 | DIRNAME=`dirname "$0"` |
paul@954 | 4 | |
paul@954 | 5 | if [ -e "$DIRNAME/config.sh" ]; then |
paul@954 | 6 | . "$DIRNAME/config.sh" |
paul@954 | 7 | else |
paul@954 | 8 | . /etc/imip-agent/config.sh |
paul@954 | 9 | fi |
paul@954 | 10 | |
paul@1008 | 11 | if [ "$1" = "--no-locale-dir" ]; then |
paul@1008 | 12 | NO_LOCALE_DIR=$1 |
paul@1008 | 13 | else |
paul@1008 | 14 | NO_LOCALE_DIR= |
paul@1008 | 15 | fi |
paul@1008 | 16 | |
paul@670 | 17 | # Agents and modules. |
paul@670 | 18 | |
paul@102 | 19 | AGENTS="imip_person.py imip_person_outgoing.py imip_resource.py" |
paul@1069 | 20 | MODULES="markup.py vCalendar.py vContent.py vRecurrence.py" |
paul@102 | 21 | |
paul@102 | 22 | if [ ! -e "$INSTALL_DIR" ]; then |
paul@102 | 23 | mkdir -p "$INSTALL_DIR" |
paul@102 | 24 | fi |
paul@102 | 25 | |
paul@102 | 26 | cp $AGENTS "$INSTALL_DIR" |
paul@102 | 27 | cp $MODULES "$INSTALL_DIR" |
paul@440 | 28 | |
paul@1028 | 29 | for DIR in "$INSTALL_DIR/imiptools" \ |
paul@1069 | 30 | "$INSTALL_DIR/imiptools/stores" \ |
paul@1028 | 31 | "$INSTALL_DIR/imiptools/handlers" \ |
paul@1028 | 32 | "$INSTALL_DIR/imiptools/handlers/scheduling" ; do |
paul@1028 | 33 | if [ ! -e "$DIR" ]; then |
paul@1028 | 34 | mkdir "$DIR" |
paul@1028 | 35 | fi |
paul@1028 | 36 | done |
paul@440 | 37 | |
paul@671 | 38 | # Remove any symbolic link to the config module. |
paul@671 | 39 | |
paul@671 | 40 | if [ -h "$INSTALL_DIR/imiptools/config.py" ]; then |
paul@671 | 41 | rm "$INSTALL_DIR/imiptools/config.py" |
paul@671 | 42 | fi |
paul@671 | 43 | |
paul@671 | 44 | # Copy modules into the installation directory. |
paul@671 | 45 | |
paul@671 | 46 | cp imiptools/*.py "$INSTALL_DIR/imiptools/" |
paul@1069 | 47 | cp imiptools/stores/*.py "$INSTALL_DIR/imiptools/stores/" |
paul@671 | 48 | cp imiptools/handlers/*.py "$INSTALL_DIR/imiptools/handlers/" |
paul@1028 | 49 | cp imiptools/handlers/scheduling/*.py "$INSTALL_DIR/imiptools/handlers/scheduling/" |
paul@1028 | 50 | |
paul@1028 | 51 | # Remove migrated modules. |
paul@1028 | 52 | |
paul@1028 | 53 | if [ -e "$INSTALL_DIR/imiptools/handlers/scheduling.py" ]; then |
paul@1028 | 54 | rm "$INSTALL_DIR/imiptools/handlers/scheduling.py"* |
paul@1028 | 55 | fi |
paul@671 | 56 | |
paul@1069 | 57 | if [ -e "$INSTALL_DIR/imip_store.py" ]; then |
paul@1069 | 58 | rm "$INSTALL_DIR/imip_store.py"* |
paul@1069 | 59 | fi |
paul@1069 | 60 | |
paul@671 | 61 | # Install the config module in a more appropriate location. |
paul@1129 | 62 | # Create new versions of configuration files instead of overwriting. |
paul@671 | 63 | |
paul@671 | 64 | if [ ! -e "$CONFIG_DIR" ]; then |
paul@671 | 65 | mkdir -p "$CONFIG_DIR" |
paul@671 | 66 | fi |
paul@671 | 67 | |
paul@671 | 68 | if [ -e "$CONFIG_DIR/config.py" ]; then |
paul@1129 | 69 | mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py.new" |
paul@1129 | 70 | else |
paul@1129 | 71 | mv "$INSTALL_DIR/imiptools/config.py" "$CONFIG_DIR/config.py" |
paul@668 | 72 | fi |
paul@668 | 73 | |
paul@891 | 74 | if [ -e "$CONFIG_DIR/config.sh" ]; then |
paul@1129 | 75 | cp "tools/config.sh" "$CONFIG_DIR/config.sh.new" |
paul@1129 | 76 | else |
paul@1129 | 77 | cp "tools/config.sh" "$CONFIG_DIR/config.sh" |
paul@891 | 78 | fi |
paul@891 | 79 | |
paul@671 | 80 | # Replace the config module with a symbolic link. |
paul@671 | 81 | |
paul@671 | 82 | ln -s "$CONFIG_DIR/config.py" "$INSTALL_DIR/imiptools/config.py" |
paul@102 | 83 | |
paul@670 | 84 | # Tools |
paul@670 | 85 | |
paul@1049 | 86 | TOOLS="fix.sh init.sh init_user.sh make_freebusy.py update_quotas.py update_scheduling_modules.py" |
paul@752 | 87 | |
paul@670 | 88 | if [ ! -e "$INSTALL_DIR/tools" ]; then |
paul@670 | 89 | mkdir -p "$INSTALL_DIR/tools" |
paul@670 | 90 | fi |
paul@670 | 91 | |
paul@752 | 92 | for TOOL in $TOOLS; do |
paul@752 | 93 | cp "tools/$TOOL" "$INSTALL_DIR/tools/" |
paul@752 | 94 | done |
paul@670 | 95 | |
paul@670 | 96 | # Web manager interface. |
paul@670 | 97 | |
paul@102 | 98 | if [ ! -e "$WEB_INSTALL_DIR" ]; then |
paul@102 | 99 | mkdir -p "$WEB_INSTALL_DIR" |
paul@102 | 100 | fi |
paul@102 | 101 | |
paul@102 | 102 | cp imip_manager.py "$WEB_INSTALL_DIR" |
paul@188 | 103 | cp htdocs/styles.css "$WEB_INSTALL_DIR" |
paul@440 | 104 | |
paul@440 | 105 | if [ ! -e "$WEB_INSTALL_DIR/imipweb" ]; then |
paul@668 | 106 | mkdir "$WEB_INSTALL_DIR/imipweb" |
paul@440 | 107 | fi |
paul@440 | 108 | |
paul@668 | 109 | cp imipweb/*.py "$WEB_INSTALL_DIR/imipweb/" |
paul@1008 | 110 | |
paul@1008 | 111 | # Locale directory. |
paul@1008 | 112 | |
paul@1008 | 113 | if [ ! "$NO_LOCALE_DIR" ] && [ -e "locale" ]; then |
paul@1008 | 114 | for DIR in "locale/"*"/LC_MESSAGES" ; do |
paul@1008 | 115 | mkdir -p "$INSTALL_DIR/$DIR" |
paul@1008 | 116 | cp "$DIR/"*.mo "$INSTALL_DIR/$DIR/" |
paul@1008 | 117 | done |
paul@1008 | 118 | fi |
paul@1036 | 119 | |
paul@1036 | 120 | # Run the scheduling module update tool to regenerate the manifest module. |
paul@1036 | 121 | |
paul@1036 | 122 | PYTHONPATH="$INSTALL_DIR" "$INSTALL_DIR/tools/update_scheduling_modules.py" |