* newinstall.sh: be smarter about how wget and curl are used
authorArt Cancro <ajc@citadel.org>
Thu, 15 Dec 2005 15:52:08 +0000 (15:52 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 15 Dec 2005 15:52:08 +0000 (15:52 +0000)
citadel/ChangeLog
citadel/newinstall.sh

index dbadb02e51285234a97ad401c8ee5f4d020394f8..f8023e4f91414c22a01d706f9036413dd1ced31a 100644 (file)
@@ -1,5 +1,8 @@
 $Id$
 
+Thu Dec 15 10:51:45 EST 2005 ajc
+* newinstall.sh: be smarter about how wget and curl are used
+
 Thu Dec 15 00:03:53 EST 2005 ajc
 * room_ops.c: when granting a room creator access to a new room, omit the
   lgetuser/lputuser calls because they are not needed.  Also, don't perform
index 43ebf97ec2b8920183ad5ed9c4d00e32ef364ef7..babd7cb221491fa836783b7368d218e3320dad11 100644 (file)
@@ -122,6 +122,24 @@ die () {
 }
 
 
+
+download_this () {
+       if [ -x `which wget` ] ; then
+               wget $FILENAME >/dev/null 2>>$LOG || die
+       else
+               if [ -x `which curl` ] ; then
+                       curl $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
@@ -156,7 +174,7 @@ determine_distribution () {
 
 install_ical () {
        cd $BUILD 2>&1 >>$LOG || die
-       $WGET $DOWNLOAD_SITE/libical-easyinstall.sum
+       FILENAME=$DOWNLOAD_SITE/libical-easyinstall.sum ; download_this
        SUM=`cat libical-easyinstall.sum`
        SUMFILE=$SUPPORT/etc/libical-easyinstall.sum
        if [ -r $SUMFILE ] ; then
@@ -167,7 +185,7 @@ install_ical () {
                fi
        fi
        echo "* Downloading libical..."
-       $WGET $DOWNLOAD_SITE/$ICAL_SOURCE 2>&1 >>$LOG || die
+       FILENAME=$DOWNLOAD_SITE/$ICAL_SOURCE ; download_this
        echo "* Installing libical..."
        ( gzip -dc $ICAL_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
        cd $BUILD/libical-0.24 2>&1 >>$LOG || die
@@ -182,7 +200,7 @@ install_ical () {
 
 install_db () {
        cd $BUILD 2>&1 >>$LOG || die
-       $WGET $DOWNLOAD_SITE/db-easyinstall.sum
+       FILENAME=$DOWNLOAD_SITE/db-easyinstall.sum ; download_this
        SUM=`cat db-easyinstall.sum`
        SUMFILE=$SUPPORT/etc/db-easyinstall.sum
        if [ -r $SUMFILE ] ; then
@@ -193,7 +211,7 @@ install_db () {
                fi
        fi
        echo "* Downloading Berkeley DB..."
-       $WGET $DOWNLOAD_SITE/$DB_SOURCE 2>&1 >>$LOG || die
+       FILENAME=$DOWNLOAD_SITE/$DB_SOURCE ; download_this
        echo "* Installing Berkeley DB..."
        ( gzip -dc $DB_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
        cd $BUILD/db-4.3.29.NC 2>&1 >>$LOG || die
@@ -247,7 +265,7 @@ install_sources () {
        export CFLAGS CPPFLAGS LDFLAGS
 
        DO_INSTALL_CITADEL=yes
-       $WGET $DOWNLOAD_SITE/citadel-easyinstall.sum
+       FILENAME=$DOWNLOAD_SITE/citadel-easyinstall.sum ; download_this
        SUM=`cat citadel-easyinstall.sum`
        SUMFILE=$CITADEL/citadel-easyinstall.sum
        if [ -r $SUMFILE ] ; then
@@ -260,7 +278,7 @@ install_sources () {
 
        if [ $DO_INSTALL_CITADEL = yes ] ; then
                echo "* Downloading Citadel..."
-               $WGET $DOWNLOAD_SITE/$CITADEL_SOURCE 2>&1 >>$LOG || die
+               FILENAME=$DOWNLOAD_SITE/$CITADEL_SOURCE ; download_this
                echo "* Installing Citadel..."
                cd $BUILD 2>&1 >>$LOG || die
                ( gzip -dc $CITADEL_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
@@ -291,7 +309,7 @@ install_sources () {
 
        cd $BUILD 2>&1 >>$LOG || die
        DO_INSTALL_WEBCIT=yes
-       $WGET $DOWNLOAD_SITE/webcit-easyinstall.sum
+       FILENAME=$DOWNLOAD_SITE/webcit-easyinstall.sum ; download_this
        SUM=`cat webcit-easyinstall.sum`
        SUMFILE=$WEBCIT/webcit-easyinstall.sum
        if [ -r $SUMFILE ] ; then
@@ -304,7 +322,7 @@ install_sources () {
 
        if [ $DO_INSTALL_WEBCIT = yes ] ; then
                echo "* Downloading WebCit..."
-               $WGET $DOWNLOAD_SITE/$WEBCIT_SOURCE 2>&1 >>$LOG || die
+               FILENAME=$DOWNLOAD_SITE/$WEBCIT_SOURCE ; download_this
                echo "* Installing WebCit..."
                cd $BUILD 2>&1 >>$LOG || die
                ( gzip -dc $WEBCIT_SOURCE | tar -xvf - ) 2>&1 >>$LOG || die
@@ -366,12 +384,9 @@ clear
 
 os=`uname`
 
-[ -z "$WGET" ] && [ -x `which wget` ] && WGET=`which wget`
-[ -z "$WGET" ] && [ -x `which curl` ] && WGET=`which curl`\ --remote-name
 
 echo MAKE is $MAKE
-echo WGET is $WGET 
-export MAKE WGET
+export MAKE
 
 # 1A. Do we use the native packaging system or build our own copy of Citadel?