imip-agent

tools/install.sh

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