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