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