]> code.citadel.org Git - citadel.git/blobdiff - citadel/newinstall.sh
* Bumped version number to 7.01
[citadel.git] / citadel / newinstall.sh
index 78e3e97b7393c76e2ce40d417e2f6d2fdad566d9..c0bdef7a3e0569baef2167c1cec29a496b31ad4f 100644 (file)
@@ -7,8 +7,7 @@
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
+#   the Free Software Foundation, version 2.
 #
 #   This program is distributed in the hope that it will be useful,
 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
 # If you're seeing this in your browser, it's probably not what you want.
 # You can either save it to disk and run it, or do it the easy way:
 #
-# wget -q -O - http://easyinstall.citadel.org/install | sh
+# curl http://easyinstall.citadel.org/install | sh
 #
 # Note that this script installs software on your system and so it requires
-# root privileges.  Feel free to inspect the script to make sure I didn't
+# root privileges.  Feel free to inspect the script to make sure we didn't
 # do anything stupid...
 #
 # We have provided you the source code according to the terms of the respective
 # not to keep the source code around.  You can always download it again later.
 #
 # We install the following versions in this release:
-# Package      Version                 Status
-# Citadel      6.24                    Latest
-# WebCit       5.23                    Latest
-# libical      0.24.RC4                Latest
-# Berkeley DB  4.1.25 + 2 patches      Stable
-# OpenLDAP     2.1.30 stable-20040329  Stable
+# Package                    Status
+# Citadel                    Latest
+# WebCit                     Latest
+# libical                    Latest
+# Berkeley DB                Stable
+# libSieve                   Stable
 
 
 ###############################################################################
@@ -70,7 +69,9 @@
 SUPPORT=/usr/local/ctdlsupport
 CITADEL=/usr/local/citadel
 WEBCIT=/usr/local/webcit
-BUILD=/tmp/citadel-build.$$
+WORKDIR=/tmp
+BUILD=$WORKDIR/citadel-build.$$
+LOG=$WORKDIR/citadel-install-log.txt
 export SUPPORT CITADEL WEBCIT
 
 MAKEOPTS=""
@@ -82,8 +83,6 @@ MAKEOPTS=""
 # CITADEL              Directory where Citadel is installed
 # WEBCIT               Directory where WebCit is installed
 # SUPPORT              Directory where support programs are installed
-# LDAP_CONFIG          Location of the slapd.conf file
-# SLAPD_BINARY         Location of the slapd binary
 # DISTRO_MAJOR         Linux distribution name, if applicable
 # DISTRO_MINOR         Linux distribution name, if applicable
 # DISTRO_VERSION       Linux distribution version (major digit) if applicable
@@ -101,27 +100,45 @@ export CITADEL_INSTALLER
 DOWNLOAD_SITE=http://easyinstall.citadel.org
 
 # Original source code packages.
-DB_SOURCE=db-4.1.25.tar.gz
-DB_PATCHES=db-4.1.25.patches
-ICAL_SOURCE=libical-0.24.RC4.tar.gz
-LDAP_SOURCE=openldap-stable-20040329.tgz
+DB_SOURCE=db-4.3.29.NC.tar.gz
+# DB_PATCHES=db-x.x.x.patches
+ICAL_SOURCE=libical-0.26-6.aurore.tar.gz
+LIBSIEVE_SOURCE=libsieve-2.2.3.tar.gz
 CITADEL_SOURCE=citadel-easyinstall.tar.gz
 WEBCIT_SOURCE=webcit-easyinstall.tar.gz
 
 SETUP="Citadel Easy Install"
 
-LOG=$BUILD/log.txt
 
 ##### BEGIN Functions #####
 
 die () {
        echo Easy Install is aborting.
        echo Please report this problem to the Citadel developers.
+       echo Log file: $LOG
        rm -fr $BUILD
        exit 1
 }
 
 
+download_this () {
+       WGET=`which wget 2>/dev/null`
+       CURL=`which curl 2>/dev/null`
+       if [ -n "${WGET}" -a -x "${WGET}" ]; then
+               $WGET $DOWNLOAD_SITE/$FILENAME >/dev/null 2>>$LOG || die
+       else
+               if [ -n "${CURL}" -a -x "${CURL}" ]; then
+                       $CURL $DOWNLOAD_SITE/$FILENAME >$FILENAME 2>>$LOG || die
+               else
+                       echo Unable to find a wget or curl command.
+                       echo Easy Install cannot continue.
+                       die;
+               fi
+       fi
+}
+
+
+
 determine_distribution () {
        # First look for Red Hat in general
        if [ -x /bin/rpm ]; then
@@ -154,63 +171,84 @@ determine_distribution () {
        # TODO: check for Debian
 }
 
-download_sources () {
-       echo "* Downloading Berkeley DB..."
-       wget -c $DOWNLOAD_SITE/$DB_SOURCE 2>&1 >>$LOG || die
-       echo "* Downloading libical..."
-       wget -c $DOWNLOAD_SITE/$ICAL_SOURCE 2>&1 >>$LOG || die
-       echo "* Downloading OpenLDAP..."
-       wget -c $DOWNLOAD_SITE/$LDAP_SOURCE 2>&1 >>$LOG || die
-       echo "* Downloading Citadel..."
-       wget -c $DOWNLOAD_SITE/$CITADEL_SOURCE 2>&1 >>$LOG || die
-       echo "* Downloading WebCit..."
-       wget -c $DOWNLOAD_SITE/$WEBCIT_SOURCE 2>&1 >>$LOG || die
-}
-
 install_ical () {
-       echo "* Installing libical..."
        cd $BUILD 2>&1 >>$LOG || die
-       ( gzip -dc $ICAL_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
-       cd $BUILD/libical-0.24 2>&1 >>$LOG || die
+       FILENAME=libical-easyinstall.sum ; download_this
+       SUM=`cat libical-easyinstall.sum`
+       SUMFILE=$SUPPORT/etc/libical-easyinstall.sum
+       if [ -r $SUMFILE ] ; then
+               OLDSUM=`cat $SUMFILE`
+               if [ $SUM = $OLDSUM ] ; then
+                       echo "* libical does not need updating."
+                       return
+               fi
+       fi
+       echo "* Downloading libical..."
+       FILENAME=$ICAL_SOURCE ; download_this
+       echo "* Installing libical..."
+       ( gzip -dc $ICAL_SOURCE | tar -xf - ) 2>&1 >>$LOG || die
+       cd $BUILD/libical-0.26 2>&1 >>$LOG || die
        ./configure --prefix=$SUPPORT 2>&1 >>$LOG || die
        $MAKE $MAKEOPTS 2>&1 >>$LOG || die
        $MAKE install 2>&1 >>$LOG || die
        echo "  Complete."
+       echo $SUM >$SUMFILE
+       rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
+       rm -f $WEBCIT/webcit-easyinstall.sum 2>/dev/null
 }
 
-install_db () {
-       echo "* Installing Berkeley DB..."
+install_libsieve () {
        cd $BUILD 2>&1 >>$LOG || die
-       ( gzip -dc $DB_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
-       cd $BUILD/db-4.1.25 2>&1 >>$LOG || die
-       #patch -p0 < ../$DB_PATCHES 2>&1 >>$LOG || die
-       cd $BUILD/db-4.1.25/build_unix 2>&1 >>$LOG || die
-       ../dist/configure --prefix=$SUPPORT --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-rpc --disable-tcl --disable-test --without-rpm 2>&1 >>$LOG || die
+       FILENAME=libsieve-easyinstall.sum ; download_this
+       SUM=`cat libsieve-easyinstall.sum`
+       SUMFILE=$SUPPORT/etc/libsieve-easyinstall.sum
+       if [ -r $SUMFILE ] ; then
+               OLDSUM=`cat $SUMFILE`
+               if [ $SUM = $OLDSUM ] ; then
+                       echo "* libsieve does not need updating."
+                       return
+               fi
+       fi
+       echo "* Downloading libsieve..."
+       FILENAME=$LIBSIEVE_SOURCE ; download_this
+       echo "* Installing libsieve..."
+       ( gzip -dc $LIBSIEVE_SOURCE | tar -xf - ) 2>&1 >>$LOG || die
+       cd $BUILD/libsieve-2.2.3/src 2>&1 >>$LOG || die
+       ./configure --prefix=$SUPPORT 2>&1 >>$LOG || die
        $MAKE $MAKEOPTS 2>&1 >>$LOG || die
        $MAKE install 2>&1 >>$LOG || die
        echo "  Complete."
+       echo $SUM >$SUMFILE
+       rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
 }
 
-install_ldap () {
-       echo "* Installing OpenLDAP..."
-       CFLAGS="${CFLAGS} -I${SUPPORT}/include"
-       CPPFLAGS="${CFLAGS}"
-       LDFLAGS="-L${SUPPORT}/lib -Wl,--rpath -Wl,${SUPPORT}/lib"
-       export CFLAGS CPPFLAGS LDFLAGS
+install_db () {
        cd $BUILD 2>&1 >>$LOG || die
-       ( gzip -dc $LDAP_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
-       cd $BUILD/openldap-2.1.29 2>&1 >>$LOG || die
-       ./configure --prefix=$SUPPORT --enable-bdb 2>&1 >>$LOG || die
+       FILENAME=db-easyinstall.sum ; download_this
+       SUM=`cat db-easyinstall.sum`
+       SUMFILE=$SUPPORT/etc/db-easyinstall.sum
+       if [ -r $SUMFILE ] ; then
+               OLDSUM=`cat $SUMFILE`
+               if [ $SUM = $OLDSUM ] ; then
+                       echo "* Berkeley DB does not need updating."
+                       return
+               fi
+       fi
+       echo "* Downloading Berkeley DB..."
+       FILENAME=$DB_SOURCE ; download_this
+       echo "* Installing Berkeley DB..."
+       ( gzip -dc $DB_SOURCE | tar -xf - ) 2>&1 >>$LOG || die
+       cd $BUILD/db-4.3.29.NC 2>&1 >>$LOG || die
+       #patch -p0 < ../$DB_PATCHES 2>&1 >>$LOG || die
+       cd $BUILD/db-4.3.29.NC/build_unix 2>&1 >>$LOG || die
+       ../dist/configure --prefix=$SUPPORT --disable-compat185 --disable-cxx --disable-debug --disable-dump185 --disable-java --disable-rpc --disable-tcl --disable-test --without-rpm 2>&1 >>$LOG || die
        $MAKE $MAKEOPTS 2>&1 >>$LOG || die
-       LDAP_CONFIG=$SUPPORT/etc/openldap/slapd.conf
-       export LDAP_CONFIG
-       SLAPD_BINARY=$SUPPORT/libexec/slapd
-       export SLAPD_BINARY
        $MAKE install 2>&1 >>$LOG || die
        echo "  Complete."
+       echo $SUM >$SUMFILE
+       rm -f $CITADEL/citadel-easyinstall.sum 2>/dev/null
 }
 
-
 install_prerequisites () {
 
        # Create the support directories if they don't already exist
@@ -229,51 +267,95 @@ install_prerequisites () {
        then
                install_ical
        fi
-       if [ -z "$OK_DB" ]
+       if [ -z "$OK_LIBSIEVE" ]
        then
-               install_db
+               install_libsieve
        fi
-       if [ -z "$OK_LDAP" ]
+       if [ -z "$OK_DB" ]
        then
-               install_ldap
+               install_db
        fi
 }
 
 install_sources () {
-       echo "* Installing Citadel..."
+       cd $BUILD 2>&1 >>$LOG || die
+       if [ -f $CITADEL/citadel.config ]
+       then
+               IS_UPGRADE=yes
+               echo "* Upgrading your existing Citadel installation."
+       else
+               IS_UPGRADE=no
+       fi
 
-       CFLAGS="${CFLAGS} -I${SUPPORT}/include"
+       CFLAGS="-I${SUPPORT}/include"
        CPPFLAGS="${CFLAGS}"
        LDFLAGS="-L${SUPPORT}/lib -Wl,--rpath -Wl,${SUPPORT}/lib"
        export CFLAGS CPPFLAGS LDFLAGS
 
-       cd $BUILD 2>&1 >>$LOG || die
-       ( gzip -dc $CITADEL_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
-       cd $BUILD/citadel 2>&1 >>$LOG || die
-       if [ -z "$OK_DB" ]
-       then
-               ./configure --prefix=$CITADEL --with-db=$SUPPORT --with-pam --enable-autologin --with-ldap --with-libical --disable-threaded-client 2>&1 >>$LOG || die
-       else
-               ./configure --prefix=$CITADEL --with-db=$OK_DB --with-pam --enable-autologin --with-ldap --with-libical --disable-threaded-client 2>&1 >>$LOG || die
+       DO_INSTALL_CITADEL=yes
+       FILENAME=citadel-easyinstall.sum ; download_this
+       SUM=`cat citadel-easyinstall.sum`
+       SUMFILE=$CITADEL/citadel-easyinstall.sum
+       if [ -r $SUMFILE ] ; then
+               OLDSUM=`cat $SUMFILE`
+               if [ $SUM = $OLDSUM ] ; then
+                       echo "* Citadel does not need updating."
+                       DO_INSTALL_CITADEL=no
+               fi
        fi
-       $MAKE $MAKEOPTS 2>&1 >>$LOG || die
-       if [ -f $CITADEL/citadel.config ]
-       then
-               $MAKE upgrade 2>&1 >>$LOG || die
-               IS_UPGRADE=yes
-       else
-               $MAKE install 2>&1 >>$LOG || die
-               useradd -c "Citadel service account" -d $CITADEL -s $CITADEL/citadel citadel 2>&1 >>$LOG
+
+       if [ $DO_INSTALL_CITADEL = yes ] ; then
+               echo "* Downloading Citadel..."
+               FILENAME=$CITADEL_SOURCE ; download_this
+               echo "* Installing Citadel..."
+               cd $BUILD 2>&1 >>$LOG || die
+               ( gzip -dc $CITADEL_SOURCE | tar -xf - ) 2>&1 >>$LOG || die
+               cd $BUILD/citadel 2>&1 >>$LOG || die
+               if [ -z "$OK_DB" ]
+               then
+                       ./configure --prefix=$CITADEL --with-db=$SUPPORT --with-pam --with-libical --disable-threaded-client 2>&1 >>$LOG || die
+               else
+                       ./configure --prefix=$CITADEL --with-db=$OK_DB --with-pam --with-libical --disable-threaded-client 2>&1 >>$LOG || die
+               fi
+               $MAKE $MAKEOPTS 2>&1 >>$LOG || die
+               if [ $IS_UPGRADE = yes ]
+               then
+                       echo "* Performing Citadel upgrade..."
+                       $MAKE upgrade 2>&1 >>$LOG || die
+               else
+                       echo "* Performing Citadel install..."
+                       $MAKE install 2>&1 >>$LOG || die
+                       useradd -c "Citadel service account" -d $CITADEL -s $CITADEL/citadel citadel 2>&1 >>$LOG
+               fi
+               echo $SUM >$SUMFILE
        fi
 
-       echo "* Installing WebCit..."
        cd $BUILD 2>&1 >>$LOG || die
-       ( gzip -dc $WEBCIT_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
-       cd $BUILD/webcit 2>&1 >>$LOG || die
-       ./configure --prefix=$WEBCIT --with-libical 2>&1 >>$LOG || die
-       $MAKE $MAKEOPTS 2>&1 >>$LOG || die
-       $MAKE install 2>&1 >>$LOG || die
-       echo "  Complete."
+       DO_INSTALL_WEBCIT=yes
+       FILENAME=webcit-easyinstall.sum ; download_this
+       SUM=`cat webcit-easyinstall.sum`
+       SUMFILE=$WEBCIT/webcit-easyinstall.sum
+       if [ -r $SUMFILE ] ; then
+               OLDSUM=`cat $SUMFILE`
+               if [ $SUM = $OLDSUM ] ; then
+                       echo "* WebCit does not need updating."
+                       DO_INSTALL_WEBCIT=no
+               fi
+       fi
+
+       if [ $DO_INSTALL_WEBCIT = yes ] ; then
+               echo "* Downloading WebCit..."
+               FILENAME=$WEBCIT_SOURCE ; download_this
+               echo "* Installing WebCit..."
+               cd $BUILD 2>&1 >>$LOG || die
+               ( gzip -dc $WEBCIT_SOURCE | tar -xf - ) 2>&1 >>$LOG || die
+               cd $BUILD/webcit 2>&1 >>$LOG || die
+               ./configure --prefix=$WEBCIT --with-libical 2>&1 >>$LOG || die
+               $MAKE $MAKEOPTS 2>&1 >>$LOG || die
+               $MAKE install 2>&1 >>$LOG || die
+               echo "  Complete."
+               echo $SUM >$SUMFILE
+       fi
 }
 
 
@@ -282,7 +364,6 @@ do_config () {
 
        if [ x$IS_UPGRADE == xyes ] ; then
                echo Upgrading your existing Citadel installation.
-               #$CITADEL/setup -q || die
                $CITADEL/setup </dev/tty || die
        else
                echo This is a new Citadel installation.
@@ -300,12 +381,36 @@ do_config () {
 
 # 1. Gather information about the target system
 
-[ -n $MAKE ] && MAKE=`which gmake`
-[ -z $MAKE ] && MAKE=`which make`
+# Non-GNU make does not work.
+# This probably ought to be fixed, but for now we will simply require GNU make.
+
+MAKE=xx
+if gmake -v 2>&1 | grep -i GNU ; then
+       MAKE=`which gmake`
+else
+       if make -v 2>&1 | grep -i GNU ; then
+               MAKE=`which make`
+       fi
+fi
+
+if [ $MAKE == xx ] ; then
+       echo
+       echo 'Easy Install requires GNU Make (gmake), which was not found.'
+       echo 'Please install gmake and try again.'
+       echo
+       exit 1
+fi
+
+export MAKE
+
 clear
 
 os=`uname`
 
+
+echo MAKE is $MAKE
+export MAKE
+
 # 1A. Do we use the native packaging system or build our own copy of Citadel?
 
 if [ "$os" = "Linux" ]; then
@@ -313,6 +418,9 @@ if [ "$os" = "Linux" ]; then
 elif [ "$os" = "FreeBSD" ]; then
        # TODO: We detect FreeBSD but the port is still out of date...
        DISTRO_MAJOR=FreeBSD
+elif [ "$os" = "Darwin" ]; then
+       # TODO: Deal with Apple weirdness
+       DISTRO_MAJOR=Darwin
 fi
 
 
@@ -321,30 +429,28 @@ mkdir -p $BUILD
 cd $BUILD
 
 
+
 # 2. Present the installation steps (from 1 above) to the user
 clear
-if dialog --clear </dev/tty ; then
+if dialog 2>&1 </dev/tty | grep gauge >/dev/null 2>&1 ; then
        CTDL_DIALOG=`which dialog`
        export CTDL_DIALOG
+elif cdialog 2>&1 </dev/tty | grep gauge >/dev/null 2>&1 ; then
+       CTDL_DIALOG=`which cdialog`
+       export CTDL_DIALOG
 fi
 clear
 
 echo "$SETUP will perform the following actions:"
 echo ""
+echo "Installation:"
+echo "* Download/install supporting libraries (if needed)"
+echo "* Download/install Citadel (if needed)"
+echo "* Download/install WebCit (if needed)"
+echo ""
 echo "Configuration:"
 echo "* Configure Citadel"
 echo "* Configure WebCit"
-echo ""
-echo "Installation:"
-
-if [ "$prepackaged" ]; then
-       show_packages_to_install
-else
-       echo "* Install supporting libraries"
-       echo "* Install Citadel"
-       echo "* Install WebCit"
-fi
-
 echo ""
 echo -n "Perform the above installation steps now? "
 read yesno </dev/tty
@@ -380,7 +486,6 @@ else
 
 # 4C. If we build our own, compile and install prerequisites then Citadel
 
-       download_sources
        install_prerequisites
        install_sources
 fi