Scalix Update 11.x: Unterschied zwischen den Versionen

Aus Neobikers Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
(17 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 3: Zeile 3:
<pre>
<pre>
scx:~# cd /usr/src
scx:~# cd /usr/src
wget -c http://downloads.scalix.com/.community/..../scalix-11.x.0-GA-debian-intel.tgz
wget -c http://downloads.scalix.com/.community/11.4/scalix-11.4.0-GA-unsupported-debian-intel.bin
tar xvzf scalix-11.x.0-GA-debian-intel.tgz
sh ./scalix-11.4.0-GA-unsupported-debian-intel.bin


cd scalix-debian-11.x.0-GA/software/scalix_server
cd scalix-debian-11.4.0-GA/software/scalix_server


../../../scx-update.sh
/usr/src/scx-update.sh
</pre>
</pre>


Bei 11.4 war mal wieder ein Paket leicht fehlerhaft, ich zeige hier beispielhaft, wie solche Fehler korrigiert werden können. Nach Fehlerbereinigung einfach das Paket entfernen und neu installieren.
In Version 11.4.0 war (mal wieder) ein Deb-Paket (leicht) fehlerhaft, ich zeige hier beispielhaft, wie solche Fehler korrigiert werden können. Nach Fehlerbereinigung einfach das Paket entfernen und neu installieren.
<pre>
<pre>
scx:/usr/src# cd scalix-debian-11.4.0-GA/software/scalix_server/
scx:/usr/src# cd scalix-debian-11.4.0-GA/software/scalix_server/
Zeile 38: Zeile 38:
</pre>
</pre>


Das Update-Script habe ich unter /usr/src liegen, da ich dort auch die verschiedenen scalix-sourcen installiert habe:
In 11.4.3 musste ich die Apache Konfiguration fixen, da Scalix die Konfigfiles umbenannt hat, aber das nicht im entsprechendem Setup-File aktualisiert hat.
<pre>scx:/etc/apache2/conf.d# grep 'ajp/' scal*
scalix-tomcat-connector.conf:#Include /etc/opt/scalix-tomcat/connector/ajp/instance-*.conf
scalix-tomcat-connector.conf:Include /etc/opt/scalix-tomcat/connector/ajp/app-*.conf
</pre>
 
Das Update-Script '''scx-update.sh''' habe ich unter '''/usr/src''' liegen, da ich dort auch die verschiedenen scalix-sourcen installiert habe:
<pre>scx:/usr/src# ls
<pre>scx:/usr/src# ls
scalix-11.3.0-U1-GA-unsupported-debian-intel.bin
scalix-11.3.0-U1-GA-unsupported-debian-intel.bin
Zeile 45: Zeile 51:
scalix-debian-11.4.0-GA/
scalix-debian-11.4.0-GA/
scx-install.sh*
scx-install.sh*
scx-reconfigure.sh*
scx-update.sh*
scx-update.sh*
</pre>
</pre>


Hier ist das Update-Script, das am Ende ein Script zur Rekonfiguration von Scalix aufruft, da die Konfig-Files beim Update überschrieben werden.
Hier ist das Scalix Update-Script.
'''/usr/src/scx-update.sh'''
'''/usr/src/scx-update.sh'''
<pre>
<pre>#!/bin/sh
#!/bin/sh
# Scalix 11.x update script
#
# Author: neobiker
# Version: $Id: scx-update.sh,v 1.6 2009/02/04 17:30:28 root Exp root $
 
scalix11version=11.4.6
dbpwd=""
ldappwd=""


main_progs="server postgres tomcat-connector tomcat_"
# load and decompress scalix packages
web_apps="swa sac mobile platform"
scalix11downloadurl="http://downloads.scalix.com/.community/${scalix11version}/scalix-${scalix11version}-GA-unsupported-debian-intel.bin"
scalix11bin=`basename $scalix11downloadurl`
scalix11dir=scalix-debian-${scalix11version}-GA


scx_pkg ()
usage ()
{
{
    dpkg -I $1 | awk '/Package/ {print $2}'
cat << EOF
Usage: $0 [-c|-i]  # update scalix packages with: dpkg -i -E <package>
 
Options are:
  -c    configure scalix, don't update/install packages
  -i    (re-)install scalix packages with: dpkg -i <package>
 
EOF
exit 0
}
}


reconfigure=`dirname $0`/scx-reconfigure.sh
# Initialise some settings
# get scalix pakage filenames: main_files, app_files, other_files
# define config files etc.
scx_initvars ()
{
  scx_main="server postgres"
  scx_apps="tomcat- tomcat_ swa sac mobile platform res sis"


  # Extract and install packages
  if [ ! -e $scalix11dir ]; then


# get actual scalix pakage filenames
    # Download Scalix 11
# main_files, web_files, other_files
    if [ ! -e $scalix11bin ]; then
        cd $src_dir
        wget -N $scalix11downloadurl
    fi


for f in ${main_progs}; do
    sh ./$scalix11bin
    main_files="${main_files} "`ls scalix-${f}*.deb`
  fi
    dropme="${dropme} | grep -v $f"
  cd $scalix11dir/software/scalix_server/
done
 
for f in ${web_apps}; do
  if [ `ls -1 scalix-*.deb 2>/dev/null | wc -l` -gt 0 ] ; then
    web_files="${web_files} "`ls scalix-${f}*.deb`
    for f in ${scx_main}; do
    dropme="${dropme} | grep -v $f"
        main_files="${main_files} "`ls scalix-${f}*.deb`
done
        dropme="${dropme} | grep -v $f"
other_files=`eval "ls -1 scalix-*.deb ${dropme}"`
    done
 
    for f in ${scx_apps}; do
        app_files="${app_files} "`ls scalix-${f}*.deb`
        dropme="${dropme} | grep -v $f"
    done
 
    other_files=`eval "ls -1 scalix-*.deb ${dropme}"`
 
    pid=$$
    host=$(hostname)
    fqdn=$(hostname -f)
    short=${host:0:1}${host: -1:1}
    base=/var/opt/scalix/${short}
    config_files="${base}/webmail/swa.properties \
      ${base}/caa/scalix.res/config/ubermanager.properties \
      ${base}/res/config/res.properties \
      ${base}/platform/platform.properties \
      ${base}/mobile/mobile.properties \
      ${base}/sis/sis.properties"
  else
    echo 'Sorry, no scalix-\*.deb packages found.'
    echo "Please change to the directory which contains the files and try again."
    exit 1
  fi
}
 
# modify scalix deb packages (for lenny)
fix_scalix_debs ()
{
  deb=`/bin/ls -1 scalix-${1}*.deb`
  if  [ -e "$deb" ]; then
 
    [ -d old ] || mkdir old
    [ -d new_$1 ] && rm -rf new_$1
    [ -d new_$1/DEBIAN ] || mkdir -p new_$1/DEBIAN
    [ -e old/$deb ] || cp $deb old/$deb
 
    dpkg -x old/$deb new_$1
    dpkg -e old/$deb new_$1/DEBIAN
 
    case $1 in
        iconv)
            file=new_$1/DEBIAN/preinst
            cat $file | sed -e 's/ "\$1" -gt 1 / -n "\$1" /g' >$file.neu
            mv $file.neu $file
            chmod a+x $file
 
            file=new_$1/DEBIAN/postrm
            cat $file | sed -e 's/ "\$1" -eq 0 / -z "\$1" /g' >$file.neu
            mv $file.neu $file
            chmod a+x $file
 
            dpkg -b new_$1 $deb
            ;;
 
        server)
            file=new_$1/DEBIAN/control
            cat $file | sed -e 's/libsasl2,/libsasl2-2,/g' \
                -e 's/libmilter[^,]*,//g' \
                -e 's/libstdc++2[^,]*,//g' >$file.neu
            mv $file.neu $file
 
            file=new_$1/DEBIAN/postinst
            cat $file | sed -e "s#OMLOGFILE='~/sys/install/log'#OMLOGFILE='~/sys/install/log';#g" >$file.neu
            mv $file.neu $file
            chmod a+x $file
 
            dpkg -b new_$1 $deb
            ;;
 
        postgres)
            file=new_$1/DEBIAN/control
            cat $file | sed -e 's/| postgresql-client-.\..//g' \
                -e 's/| postgresql-.\..//g' >$file.neu
            mv $file.neu $file
 
            dpkg -b new_$1 $deb
            ;;
 
        *)
            ;;
    esac
  fi
}
 
apache_config ()
{
  # Setup Apache
  file=/etc/apache2/conf.d/scalix-web-client.conf
  [ -e $file ] || ln -s /opt/scalix/global/httpd/scalix-web-client.conf $file
 
  cat << EOT > /etc/apache2/conf.d/scalix-access.conf
<Location />
        Allow from all
</Location>
EOT
 
  file=/etc/opt/scalix-tomcat/connector/ajp/instance-$mnode.conf
  if [ ! -e $file ]; then
    echo 'Include /etc/opt/scalix-tomcat/connector/ajp/app-*.conf' > $file
  fi


  files="/etc/opt/scalix-tomcat/connector/ajp/*-$mnode*.conf \
      /etc/opt/scalix-tomcat/connector/jk/*-$mnode*.conf"
  for file in $files; do
    if [ -e $file ]; then
      sed -e 's;<VirtualHost;#<VirtualHost;g' \
          -e 's;</VirtualHost;#</VirtualHost;g' \
          $file > $file.neu
      mv $file.neu $file
    fi
  done
}


# Now Update the scalix pakages
scx_update ()
# The Web applications will be removed first
{
    echo ""
    echo "Removing Scalix applications:"
    for file in ${app_files}; do
        pkgs="${pkgs} "`scx_pkgname ${file}`
    done
    echo "removing ${pkgs}"
    aptitude remove ${pkgs}


if [ -n "${main_files}" ]; then
     echo "Updating Scalix Server"
     echo "Updating Scalix Server"
     dpkg -i -E ${main_files}
 
     dpkg -i -E ${other_files}
     dpkg -i --force-overwrite $opt_update ${main_files}
     dpkg -i --force-overwrite $opt_update ${other_files}


     echo ""
     echo ""
     echo "Reinstalling Scalix Webapplications:"
     echo "Reinstalling Scalix applications:"
     for file in ${web_files}; do
     for file in ${app_files}; do
         pkg=`scx_pkg ${file}`
         pkg=`scx_pkgname ${file}`
         echo "updating ${pkg}: ${file}"
         echo "updating ${pkg}: ${file}"
        dpkg -r ${pkg}
         if ! dpkg -i --force-overwrite ${file} ; then
         if ! dpkg -i ${file} ; then
           echo ">>> Warning: dpkg returned an error. <<<"
           echo ">>> Warning: dpkg returned an error. <<<"
           echo ""
           echo ""
         fi
         fi
     done
     done
    echo "Scalix Configuration files must be reconfigured."
}
# configure scalix
scx_configure ()
{
    if [ "x$dbpwd" == "x" ]; then
        echo .
        echo "Scalix configuration:"
        echo "---------------------"
        echo "Scalix DB-Password ? "
        read dbpwd
    fi


else
    tomcatport=80
     echo 'Sorry, no scalix-\*.deb pakages found.'
 
     echo "Please change to the directory which contains the files and try again."
     for file in ${config_files}; do
    exit 1
      sed -e "s;%LOCALDOMAIN%;$ldomain;g" \
fi
          -e "s;%LOCALHOST%;$fqdn;g" \
          -e "s;%IMAPHOST%;$fqdn;g" \
          -e "s;%SMTPHOST%;$fqdn;g" \
          -e "s;%DBHOST%;$fqdn:5733;g" \
          -e "s;%DBPASSWD%;$dbpwd;g" \
          -e "s;%LDAPPORT%;389;g" \
          -e "s;http://%PLATFORMURL%:8080/api;http://$fqdn/api;g" \
          -e "s;%PLATFORMURL%;http://$fqdn/api;g" \
          -e "s;swa.platform.enabled=false;swa.platform.enabled=true;g" \
          -e "s;__SECURED_MODE__;false;g" \
          -e "s;ubermanager/__FQHN_HOST__@__KERBEROS_REALM__;;g" \
          -e "s;__KERBEROS_REALM__;;g" \
          -e "s;__FQHN_FOR_KDC_HOST__;;g" \
          -e "s;__FQHN_QUERY_SERVER_NAME__;$fqdn;g" \
          -e "s;__UBERMGR_USE_EXTERNAL_AUTH__;false;g" \
          -e "s;__UBERMGR_ALLOW_EXTERNAL_AUTH__;false;g" \
          -e "s;__UBERMGR_MAXLIST_SIZE__;100;g" \
          -e "s;__UBERMGR_MAIL_DOMAINS_LIST__;$ldomain;g" \
          -e "s;__UBERMGR_EXTERNAL_DOMAIN_AUTH_LIST__;;g" \
          -e "s;__CONFIGURED__;true;g" \
          -e "s;__FQHN_FOR_UBERMANAGER__;$fqdn;g" \
          -e "s;__TOMCAT_PORT__;$tomcatport;g" \
          -e "s;localhost;$fqdn;g" \
          -e "s;%INDEX-WHITELIST%;$fqdn;g" \
          -e "s;%SEARCH-WHITELIST%;$fqdn;g" \
          -e "s;%INDEXADMIN-WHITELIST%;$fqdn;g" \
          -e "s;%SIS-LANGUAGE%;German;g" \
          ${file} > ${file}.new
        mv $file.new $file
    done
 
    # some (optional) GERMAN settings
    for file in ${config_files}; do
      sed -e "s;ubermanager.console.defaultCountry=US;ubermanager.console.defaultCountry=DE;g" \
          -e "s;ubermanager.console.defaultLanguage=AMERICAN;ubermanager.console.defaultLanguage=GERMAN;g" \
          -e "s;swa.user.locale=en_US;swa.user.locale=de_DE;g" \
          -e "s;swa.user.preferredDateTimeFormat=1;swa.user.preferredDateTimeFormat=2;g" \
          -e "s;swa.user.dateSeparatorChar=/;swa.user.dateSeparatorChar=.;g" \
          -e "s;swa.user.weekStart=0;swa.user.weekStart=1;g" \
          -e "s;swa.user.defaultCalendarView=0;swa.user.defaultCalendarView=2;g" \
          ${file} > ${file}.new
        mv $file.new $file
    done
 
    # If SAC Login doesn't work, try this
     # Write Ldappassword to psdata
    file=${base}/caa/scalix.res/config/psdata
    if [ ! -e ${file} ]; then
        if [ "x$ldappwd" == "x" ]; then
          echo "Scalix LDAP-Password [DB-Password]? "
          read ldappwd
          [ -z "$ldappwd" ] && ldappwd=$dbpwd
        fi
        echo "${ldappwd}" > ${file}
        chown root:root ${file}
        chmod 400 ${file}
        ommodu sxqueryadmin -p $ldappwd
    fi
}
 
# backup scalix config files
scx_backup_config ()
{
    for f in ${config_files}; do
      mkdir -p `dirname ${base}/scalix-config-backup-${pid}${f}`
      cp ${f} ${base}/scalix-config-backup-${pid}${f}
      cp ${f} ${f}.bak
    done
}
 
# show differences to new config files
scx_diff_config ()
{
    for file in ${config_files}; do
 
      sed -e 's/#.*//g' \
          -e '/^$/ D' \
          ${file} | sort > ${file}.new
 
      sed -e 's/#.*//g' \
          -e '/^$/ D' \
          ${base}/scalix-config-backup-${pid}${file} | sort > ${file}.old
 
      if ! diff -q ${file}.old ${file}.new; then
          echo "-------------------------------------------------"
          echo "Check changes in ${file}:"
 
          diff ${file}.old ${file}.new


echo "We have to reconfigure the Scalix Configuration files."
          echo ">>> Restore old Configfile [y] ?"
${reconfigure}
          read a


echo "Scalix Config-files are reconfigured."
          if [ -z "$a" -o "$a" == "y" -o "$a" == "Y" ]; then
</pre>
            cp ${file} ${file}.new.update
            cp ${base}/scalix-config-backup-${pid}${file} ${file}
            echo "restored ${file} !!! <<<"
          fi
          echo "-------------------------------------------------"
          echo ""
      fi
 
    done


Dieses Skript rekonfiguriert Scalix nach Änderungen:
    echo ">>> Remove temp. Backupfiles (${base}/scalix-config-backup-${pid}) [y] ?"
    read a


'''/usr/src/scx-reconfigure.sh'''
    if [ -z "$a" -o "$a" == "y" -o "$a" == "Y" ]; then
<pre>
          rm -rf ${base}/scalix-config-backup-${pid}
#!/bin/sh
          echo "${base}/scalix-config-backup-${pid} deleted"
#
    fi
}


echo "Scalix Password ? "
scx_tomcat_restart ()
read geheim
{
    echo "Scalix tomcat restart..."
    /etc/init.d/apache2 restart
    /etc/init.d/scalix-tomcat restart
}


dbpwd=$geheim
scx_restart ()
ldappwd=$geheim
{
    echo "Scalix restart..."
    for f in /etc/rc1.d/K*scalix* /etc/rc1.d/K*apache2; do $f stop 2>/dev/null; done
    for f in /etc/rc2.d/S*apache2 /etc/rc2.d/S*scalix*; do $f start; done
    echo "Scalix restarted."
}


tomcatport=80
# get pakage name (used by dpkg -r <package>)
ldomain=$(hostname -d)
scx_pkgname ()
host=$(hostname)
{
fqdn=$(hostname -f)
    dpkg -I $1 | awk '/Package/ {print $2}'
short=${host:0:1}${host: -1:1}
}


base=/var/opt/scalix/${short}
# set script options
files="$base/webmail/swa.properties \
opt_update="-E"
      $base/caa/scalix.res/config/ubermanager.properties \
      $base/res/config/res.properties \
      $base/platform/platform.properties \
      $base/mobile/mobile.properties \
      $base/sis/sis.properties"


for file in $files; do
while getopts "chi" option
  sed -e "s;%LOCALDOMAIN%;$ldomain;g" \
do
    -e "s;%LOCALHOST%;$fqdn;g" \
        case $option in
    -e "s;%IMAPHOST%;$fqdn;g" \
        c)  opt_configure=1
    -e "s;%SMTPHOST%;$fqdn;g" \
            ;;
    -e "s;%DBHOST%;$fqdn:5733;g" \
        h)  usage
    -e "s;%DBPASSWD%;$dbpwd;g" \
            ;;
    -e "s;%LDAPPORT%;389;g" \
        i)  opt_update=""
    -e "s;http://%PLATFORMURL%:8080/api;http://$fqdn/api;g" \
            ;;
    -e "s;%PLATFORMURL%;http://$fqdn/api;g" \
        *)  usage
    -e "s;swa.platform.enabled=false;swa.platform.enabled=true;g" \
            ;;
    -e "s;__SECURED_MODE__;false;g" \
        esac
    -e "s;ubermanager/__FQHN_HOST__@__KERBEROS_REALM__;;g" \
    -e "s;__KERBEROS_REALM__;;g" \
    -e "s;__FQHN_FOR_KDC_HOST__;;g" \
    -e "s;__FQHN_QUERY_SERVER_NAME__;$fqdn;g" \
    -e "s;__UBERMGR_USE_EXTERNAL_AUTH__;false;g" \
    -e "s;__UBERMGR_ALLOW_EXTERNAL_AUTH__;false;g" \
    -e "s;__UBERMGR_MAXLIST_SIZE__;100;g" \
    -e "s;__UBERMGR_MAIL_DOMAINS_LIST__;$ldomain;g" \
    -e "s;__UBERMGR_EXTERNAL_DOMAIN_AUTH_LIST__;;g" \
    -e "s;__CONFIGURED__;true;g" \
    -e "s;__FQHN_FOR_UBERMANAGER__;$fqdn;g" \
    -e "s;__TOMCAT_PORT__;$tomcatport;g" \
    -e "s;localhost;$fqdn;g" \
    -e "s;%SIS-LANGUAGE%;German;g" \
    -e "s;%INDEX-WHITELIST%;$fqdn;g" \
    -e "s;%SEARCH-WHITELIST%;$fqdn;g" \
    $file > $file.neu
  mv $file.neu $file
done
done


# If SAC Login doesn't work, try this
# Update scalix pakages:
# Write Ldappassword to psdata
# backup config-files
if [ ! -e ${base}/caa/scalix.res/config/psdata ]; then
# update scalix pakages: Web applications need 'remove' first
    echo "$ldappwd" > ${base}/caa/scalix.res/config/psdata
# reconfigure scalix
    chown root:root ${base}/caa/scalix.res/config/psdata
 
    chmod 400 ${base}/caa/scalix.res/config/psdata
scx_initvars
fi
scx_backup_config


for f in /etc/rc1.d/K*scalix*; do $f stop; done
fix_scalix_debs iconv
for f in /etc/rc2.d/S*scalix*; do $f start; done
fix_scalix_debs server
fix_scalix_debs postgres
 
[ -z "$opt_configure" ] && scx_update
scx_configure
apache_config
 
scx_diff_config
#scx_tomcat_restart
scx_restart
</pre>
</pre>
Das Skript konfiguriert Scalix, z.B. nach einem update, da die Konfig-Files beim Update überschrieben werden.
Siehe auch mein (Re-)[http://www.neobiker.de/wiki/index.php?title=Scalix_mit_Debian_Etch#Installation Installationsskript für Scalix].

Aktuelle Version vom 14. Februar 2010, 17:25 Uhr

Scalix Update

Scalix Sourcen laden und updaten.

scx:~# cd /usr/src
wget -c http://downloads.scalix.com/.community/11.4/scalix-11.4.0-GA-unsupported-debian-intel.bin
sh ./scalix-11.4.0-GA-unsupported-debian-intel.bin

cd scalix-debian-11.4.0-GA/software/scalix_server

/usr/src/scx-update.sh

In Version 11.4.0 war (mal wieder) ein Deb-Paket (leicht) fehlerhaft, ich zeige hier beispielhaft, wie solche Fehler korrigiert werden können. Nach Fehlerbereinigung einfach das Paket entfernen und neu installieren.

scx:/usr/src# cd scalix-debian-11.4.0-GA/software/scalix_server/

mkdir -p old new/DEBIAN
mv scalix-iconv-extras_1.2-1_i386.deb old
dpkg -x old/scalix-iconv-extras_1.2-1_i386.deb new
dpkg -e old/scalix-iconv-extras_1.2-1_i386.deb new/DEBIAN

vi new/DEBIAN/preinst
# ... Zeile 3 korrigieren
    if [ -n "$1" ]; then
# ...

vi new/DEBIAN/postrm
# ... Zeile 2 korrigieren
    if [ -z "$1" ]; then
# ...

# Jetzt das korrigierte Paket bauen
dpkg -b new scalix-iconv-extras_1.2-1_i386.deb 

# Fertig :-)
dpkg -r scalix-iconv-extras
dpkg -i scalix-iconv-extras_1.2-1_i386.deb

In 11.4.3 musste ich die Apache Konfiguration fixen, da Scalix die Konfigfiles umbenannt hat, aber das nicht im entsprechendem Setup-File aktualisiert hat.

scx:/etc/apache2/conf.d# grep 'ajp/' scal*
scalix-tomcat-connector.conf:#Include /etc/opt/scalix-tomcat/connector/ajp/instance-*.conf
scalix-tomcat-connector.conf:Include /etc/opt/scalix-tomcat/connector/ajp/app-*.conf

Das Update-Script scx-update.sh habe ich unter /usr/src liegen, da ich dort auch die verschiedenen scalix-sourcen installiert habe:

scx:/usr/src# ls
scalix-11.3.0-U1-GA-unsupported-debian-intel.bin
scalix-11.4.0-GA-unsupported-debian-intel.bin
scalix-debian-11.3.0-GA/
scalix-debian-11.4.0-GA/
scx-install.sh*
scx-update.sh*

Hier ist das Scalix Update-Script. /usr/src/scx-update.sh

#!/bin/sh
# Scalix 11.x update script
# Author: neobiker
# Version: $Id: scx-update.sh,v 1.6 2009/02/04 17:30:28 root Exp root $

scalix11version=11.4.6
dbpwd=""
ldappwd=""

# load and decompress scalix packages
scalix11downloadurl="http://downloads.scalix.com/.community/${scalix11version}/scalix-${scalix11version}-GA-unsupported-debian-intel.bin"
scalix11bin=`basename $scalix11downloadurl`
scalix11dir=scalix-debian-${scalix11version}-GA

usage ()
{
cat << EOF
Usage: $0 [-c|-i]  # update scalix packages with: dpkg -i -E <package>

Options are:
  -c    configure scalix, don't update/install packages
  -i    (re-)install scalix packages with: dpkg -i <package>

EOF
exit 0
}

# Initialise some settings
# get scalix pakage filenames: main_files, app_files, other_files
# define config files etc.
scx_initvars ()
{
  scx_main="server postgres"
  scx_apps="tomcat- tomcat_ swa sac mobile platform res sis"

  # Extract and install packages
  if [ ! -e $scalix11dir ]; then

    # Download Scalix 11
    if [ ! -e $scalix11bin ]; then
        cd $src_dir
        wget -N $scalix11downloadurl
    fi

    sh ./$scalix11bin
  fi
  cd $scalix11dir/software/scalix_server/

  if [ `ls -1 scalix-*.deb 2>/dev/null | wc -l` -gt 0 ] ; then
    for f in ${scx_main}; do
        main_files="${main_files} "`ls scalix-${f}*.deb`
        dropme="${dropme} | grep -v $f"
    done

    for f in ${scx_apps}; do
        app_files="${app_files} "`ls scalix-${f}*.deb`
        dropme="${dropme} | grep -v $f"
    done

    other_files=`eval "ls -1 scalix-*.deb ${dropme}"`

    pid=$$
    host=$(hostname)
    fqdn=$(hostname -f)
    short=${host:0:1}${host: -1:1}
    base=/var/opt/scalix/${short}
    config_files="${base}/webmail/swa.properties \
       ${base}/caa/scalix.res/config/ubermanager.properties \
       ${base}/res/config/res.properties \
       ${base}/platform/platform.properties \
       ${base}/mobile/mobile.properties \
       ${base}/sis/sis.properties"
  else
    echo 'Sorry, no scalix-\*.deb packages found.'
    echo "Please change to the directory which contains the files and try again."
    exit 1
  fi
}

# modify scalix deb packages (for lenny)
fix_scalix_debs ()
{
  deb=`/bin/ls -1 scalix-${1}*.deb`
  if  [ -e "$deb" ]; then

    [ -d old ] || mkdir old
    [ -d new_$1 ] && rm -rf new_$1
    [ -d new_$1/DEBIAN ] || mkdir -p new_$1/DEBIAN
    [ -e old/$deb ] || cp $deb old/$deb

    dpkg -x old/$deb new_$1
    dpkg -e old/$deb new_$1/DEBIAN

    case $1 in
        iconv)
            file=new_$1/DEBIAN/preinst
            cat $file | sed -e 's/ "\$1" -gt 1 / -n "\$1" /g' >$file.neu
            mv $file.neu $file
            chmod a+x $file

            file=new_$1/DEBIAN/postrm
            cat $file | sed -e 's/ "\$1" -eq 0 / -z "\$1" /g' >$file.neu
            mv $file.neu $file
            chmod a+x $file

            dpkg -b new_$1 $deb
            ;;

        server)
            file=new_$1/DEBIAN/control
            cat $file | sed -e 's/libsasl2,/libsasl2-2,/g' \
                -e 's/libmilter[^,]*,//g' \
                -e 's/libstdc++2[^,]*,//g' >$file.neu
            mv $file.neu $file

            file=new_$1/DEBIAN/postinst
            cat $file | sed -e "s#OMLOGFILE='~/sys/install/log'#OMLOGFILE='~/sys/install/log';#g" >$file.neu
            mv $file.neu $file
            chmod a+x $file

            dpkg -b new_$1 $deb
            ;;

        postgres)
            file=new_$1/DEBIAN/control
            cat $file | sed -e 's/| postgresql-client-.\..//g' \
                -e 's/| postgresql-.\..//g' >$file.neu
            mv $file.neu $file

            dpkg -b new_$1 $deb
            ;;

        *)
            ;;
    esac
  fi
}

apache_config ()
{
  # Setup Apache
  file=/etc/apache2/conf.d/scalix-web-client.conf
  [ -e $file ] || ln -s /opt/scalix/global/httpd/scalix-web-client.conf $file

  cat << EOT > /etc/apache2/conf.d/scalix-access.conf
<Location />
        Allow from all
</Location>
EOT

  file=/etc/opt/scalix-tomcat/connector/ajp/instance-$mnode.conf
  if [ ! -e $file ]; then
    echo 'Include /etc/opt/scalix-tomcat/connector/ajp/app-*.conf' > $file
  fi

  files="/etc/opt/scalix-tomcat/connector/ajp/*-$mnode*.conf \
       /etc/opt/scalix-tomcat/connector/jk/*-$mnode*.conf"
  for file in $files; do
    if [ -e $file ]; then
      sed -e 's;<VirtualHost;#<VirtualHost;g' \
          -e 's;</VirtualHost;#</VirtualHost;g' \
          $file > $file.neu
      mv $file.neu $file
    fi
  done
}

scx_update ()
{
    echo ""
    echo "Removing Scalix applications:"
    for file in ${app_files}; do
        pkgs="${pkgs} "`scx_pkgname ${file}`
    done
    echo "removing ${pkgs}"
    aptitude remove ${pkgs}

    echo "Updating Scalix Server"

    dpkg -i --force-overwrite $opt_update ${main_files}
    dpkg -i --force-overwrite $opt_update ${other_files}

    echo ""
    echo "Reinstalling Scalix applications:"
    for file in ${app_files}; do
        pkg=`scx_pkgname ${file}`
        echo "updating ${pkg}: ${file}"
        if ! dpkg -i --force-overwrite ${file} ; then
          echo ">>> Warning: dpkg returned an error. <<<"
          echo ""
        fi
    done
    echo "Scalix Configuration files must be reconfigured."
}

# configure scalix
scx_configure ()
{
    if [ "x$dbpwd" == "x" ]; then
        echo .
        echo "Scalix configuration:"
        echo "---------------------"
        echo "Scalix DB-Password ? "
        read dbpwd
    fi

    tomcatport=80

    for file in ${config_files}; do
      sed -e "s;%LOCALDOMAIN%;$ldomain;g" \
          -e "s;%LOCALHOST%;$fqdn;g" \
          -e "s;%IMAPHOST%;$fqdn;g" \
          -e "s;%SMTPHOST%;$fqdn;g" \
          -e "s;%DBHOST%;$fqdn:5733;g" \
          -e "s;%DBPASSWD%;$dbpwd;g" \
          -e "s;%LDAPPORT%;389;g" \
          -e "s;http://%PLATFORMURL%:8080/api;http://$fqdn/api;g" \
          -e "s;%PLATFORMURL%;http://$fqdn/api;g" \
          -e "s;swa.platform.enabled=false;swa.platform.enabled=true;g" \
          -e "s;__SECURED_MODE__;false;g" \
          -e "s;ubermanager/__FQHN_HOST__@__KERBEROS_REALM__;;g" \
          -e "s;__KERBEROS_REALM__;;g" \
          -e "s;__FQHN_FOR_KDC_HOST__;;g" \
          -e "s;__FQHN_QUERY_SERVER_NAME__;$fqdn;g" \
          -e "s;__UBERMGR_USE_EXTERNAL_AUTH__;false;g" \
          -e "s;__UBERMGR_ALLOW_EXTERNAL_AUTH__;false;g" \
          -e "s;__UBERMGR_MAXLIST_SIZE__;100;g" \
          -e "s;__UBERMGR_MAIL_DOMAINS_LIST__;$ldomain;g" \
          -e "s;__UBERMGR_EXTERNAL_DOMAIN_AUTH_LIST__;;g" \
          -e "s;__CONFIGURED__;true;g" \
          -e "s;__FQHN_FOR_UBERMANAGER__;$fqdn;g" \
          -e "s;__TOMCAT_PORT__;$tomcatport;g" \
          -e "s;localhost;$fqdn;g" \
          -e "s;%INDEX-WHITELIST%;$fqdn;g" \
          -e "s;%SEARCH-WHITELIST%;$fqdn;g" \
          -e "s;%INDEXADMIN-WHITELIST%;$fqdn;g" \
          -e "s;%SIS-LANGUAGE%;German;g" \
          ${file} > ${file}.new
        mv $file.new $file
    done

    # some (optional) GERMAN settings
    for file in ${config_files}; do
      sed -e "s;ubermanager.console.defaultCountry=US;ubermanager.console.defaultCountry=DE;g" \
          -e "s;ubermanager.console.defaultLanguage=AMERICAN;ubermanager.console.defaultLanguage=GERMAN;g" \
          -e "s;swa.user.locale=en_US;swa.user.locale=de_DE;g" \
          -e "s;swa.user.preferredDateTimeFormat=1;swa.user.preferredDateTimeFormat=2;g" \
          -e "s;swa.user.dateSeparatorChar=/;swa.user.dateSeparatorChar=.;g" \
          -e "s;swa.user.weekStart=0;swa.user.weekStart=1;g" \
          -e "s;swa.user.defaultCalendarView=0;swa.user.defaultCalendarView=2;g" \
          ${file} > ${file}.new
        mv $file.new $file
    done

    # If SAC Login doesn't work, try this
    # Write Ldappassword to psdata
    file=${base}/caa/scalix.res/config/psdata
    if [ ! -e ${file} ]; then
        if [ "x$ldappwd" == "x" ]; then
          echo "Scalix LDAP-Password [DB-Password]? "
          read ldappwd
          [ -z "$ldappwd" ] && ldappwd=$dbpwd
        fi
        echo "${ldappwd}" > ${file}
        chown root:root ${file}
        chmod 400 ${file}
        ommodu sxqueryadmin -p $ldappwd
    fi
}

# backup scalix config files
scx_backup_config ()
{
    for f in ${config_files}; do
       mkdir -p `dirname ${base}/scalix-config-backup-${pid}${f}`
       cp ${f} ${base}/scalix-config-backup-${pid}${f}
       cp ${f} ${f}.bak
    done
}

# show differences to new config files
scx_diff_config ()
{
    for file in ${config_files}; do

      sed -e 's/#.*//g' \
          -e '/^$/ D' \
          ${file} | sort > ${file}.new

      sed -e 's/#.*//g' \
          -e '/^$/ D' \
          ${base}/scalix-config-backup-${pid}${file} | sort > ${file}.old

      if ! diff -q ${file}.old ${file}.new; then
          echo "-------------------------------------------------"
          echo "Check changes in ${file}:"

          diff ${file}.old ${file}.new

          echo ">>> Restore old Configfile [y] ?"
          read a

          if [ -z "$a" -o "$a" == "y" -o "$a" == "Y" ]; then
            cp ${file} ${file}.new.update
            cp ${base}/scalix-config-backup-${pid}${file} ${file}
            echo "restored ${file} !!! <<<"
          fi
          echo "-------------------------------------------------"
          echo ""
      fi

    done

    echo ">>> Remove temp. Backupfiles (${base}/scalix-config-backup-${pid}) [y] ?"
    read a

    if [ -z "$a" -o "$a" == "y" -o "$a" == "Y" ]; then
          rm -rf ${base}/scalix-config-backup-${pid}
          echo "${base}/scalix-config-backup-${pid} deleted"
    fi
}

scx_tomcat_restart ()
{
    echo "Scalix tomcat restart..."
    /etc/init.d/apache2 restart
    /etc/init.d/scalix-tomcat restart
}

scx_restart ()
{
    echo "Scalix restart..."
    for f in /etc/rc1.d/K*scalix* /etc/rc1.d/K*apache2; do $f stop 2>/dev/null; done
    for f in /etc/rc2.d/S*apache2 /etc/rc2.d/S*scalix*; do $f start; done
    echo "Scalix restarted."
}

# get pakage name (used by dpkg -r <package>)
scx_pkgname ()
{
    dpkg -I $1 | awk '/Package/ {print $2}'
}

# set script options
opt_update="-E"

while getopts "chi" option
do
        case $option in
        c)   opt_configure=1
             ;;
        h)   usage
             ;;
        i)   opt_update=""
             ;;
        *)   usage
             ;;
        esac
done

# Update scalix pakages:
# backup config-files
# update scalix pakages: Web applications need 'remove' first
# reconfigure scalix

scx_initvars
scx_backup_config

fix_scalix_debs iconv
fix_scalix_debs server
fix_scalix_debs postgres

[ -z "$opt_configure" ] && scx_update
scx_configure
apache_config

scx_diff_config
#scx_tomcat_restart
scx_restart

Das Skript konfiguriert Scalix, z.B. nach einem update, da die Konfig-Files beim Update überschrieben werden.

Siehe auch mein (Re-)Installationsskript für Scalix.