JBoss Native SVN: r2071 - trunk/mod_cluster/test/java.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-11-27 07:05:57 -0500 (Thu, 27 Nov 2008)
New Revision: 2071
Modified:
trunk/mod_cluster/test/java/build.xml
trunk/mod_cluster/test/java/installhttpd.sh
Log:
Arrange logic to download the bundle automaticly.
Modified: trunk/mod_cluster/test/java/build.xml
===================================================================
--- trunk/mod_cluster/test/java/build.xml 2008-11-27 12:04:58 UTC (rev 2070)
+++ trunk/mod_cluster/test/java/build.xml 2008-11-27 12:05:57 UTC (rev 2071)
@@ -60,6 +60,10 @@
</fileset>
-->
</path>
+
+ <target name="base">
+ <echo message="${base.path}"/>
+ </target>
<target name="compile">
@@ -158,7 +162,7 @@
<target name="testexist">
<echo message="Testing for ${destfile}"/>
- <available file="${destfile}" property="exist"/>
+ <available file="${base.path}/${destfile}" property="exist"/>
</target>
<target name="downloadgz" unless="exist" depends="setproxy,testexist">
Modified: trunk/mod_cluster/test/java/installhttpd.sh
===================================================================
--- trunk/mod_cluster/test/java/installhttpd.sh 2008-11-27 12:04:58 UTC (rev 2070)
+++ trunk/mod_cluster/test/java/installhttpd.sh 2008-11-27 12:05:57 UTC (rev 2071)
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Script to install httpd in $HOME and configure it for mod_cluster tests.
+# Script to install httpd in $BASELOC and configure it for mod_cluster tests.
# $1: IP address to listen (both for normal requests and cluster management ones.
# $2: IP address for the advertise
# $3: sub network to accept cluster management requests.
@@ -20,28 +20,122 @@
SUBIP=$3
fi
-HOME=`pwd`
-export HOME
-files="opt/jboss/httpd/sbin/apachectl opt/jboss/httpd/httpd/conf/httpd.conf /opt/jboss/httpd/sbin/envvars"
+#
+# Set the platform and arch for the download bundles.
+if [ "x" = "x$BUILD_CPU" ]; then
+ BUILD_CPU=`uname -m`
+fi
+case ${BUILD_CPU} in
+ sun4u*)
+ BUILD_CPU=sparcv9
+ ;;
+ i86pc*)
+ BUILD_CPU=x86
+ ;;
+ i[3-6]86*)
+ BUILD_CPU=x86
+ ;;
+ x86_64*)
+ BUILD_CPU=x64
+ ;;
+ ia64*)
+ BUILD_CPU=i64
+ ;;
+ 9000/800*)
+ BUILD_CPU=parisc2
+ ;;
+ Power*)
+ BUILD_CPU=ppc
+ ;;
+esac
+
+if [ "x" = "x$BUILD_SYS" ]; then
+ BUILD_SYS=`uname -s`
+fi
+case ${BUILD_SYS} in
+ Linux*)
+ BUILD_SYS="linux2"
+ ;;
+ SunOS*)
+ BUILD_SYS="solaris"
+ ;;
+ Darwin*)
+ BUILD_SYS="macosx"
+ ;;
+ HP-UX*)
+ BUILD_SYS="hpux"
+ ;;
+ CYGWIN*)
+ BUILD_SYS=windows
+ ;;
+esac
+
+# Display what we are going to do.
+echo "on ${BUILD_SYS} ${BUILD_CPU}"
+BUILD_TAG=${BUILD_SYS}-${BUILD_CPU}
+EXT=tar.gz
+case $BUILD_TAG in
+ *hpux-parisc2*)
+ BASE=mod_cluster-hp-ux-9000_800
+ ;;
+ *hpux-i64*)
+ BASE=mod_cluster-hp-ux-ia64
+ ;;
+ *linux2-x86*)
+ BASE=mod_cluster-linux-i686
+ ;;
+ *linux2-i64*)
+ BASE=mod_cluster-linux-ia64
+ ;;
+ *linux2-x64*)
+ BASE=mod_cluster-linux-x86_64
+ ;;
+ *solaris-sparcv9*)
+ BASE=mod_cluster-solaris-sparc
+ ;;
+ *solaris-x86*)
+ BASE=mod_cluster-solaris-x86
+ ;;
+ *windows*)
+ BASE=mod_cluster-windows
+ ;;
+esac
+PACKAGE=rhel-httpd-2.2.8-1.el5s2
+
+# Something like (note don't use ssl for the moment.
+# http://hudson.qa.jboss.com/hudson/view/Native/job/mod_cluster-linux-x86_6...
+TARBALL=http://hudson.qa.jboss.com/hudson/view/Native/job/${BASE}/lastSuccessfulBuild/artifact/jbossnative/build/unix/output/${PACKAGE}-${BUILD_SYS}-${BUILD_CPU}.${EXT}
+ant downloadgz -Dsourcefile=${TARBALL} -Ddestfile=opt/jboss/httpd/sbin/apachectl
+if [ $? -ne 0 ]; then
+ echo "Download of $TARBALL failed"
+fi
+BASELOC=`ant base | grep echo | awk '{ print $2 }'`
+export BASELOC
+echo "Base is: $BASELOC !!!"
+
+#
+# Arrange the installed files
+#
+files="opt/jboss/httpd/sbin/apachectl opt/jboss/httpd/httpd/conf/httpd.conf opt/jboss/httpd/sbin/envvars"
for FILE in `echo $files`
do
- file=${HOME}/$FILE
+ file=${BASELOC}/$FILE
echo "$file"
cp -p $file $file.new
- sed "s:opt/jboss/httpd:${HOME}/opt/jboss/httpd:" $file > $file.new
+ sed "s:opt/jboss/httpd:${BASELOC}/opt/jboss/httpd:" $file > $file.new
mv $file $file.`date +%y%m%d.%H%M%S`.org
mv $file.new $file
done
# Arrange apachectl
-file=$HOME/opt/jboss/httpd/sbin/apachectl
+file=$BASELOC/opt/jboss/httpd/sbin/apachectl
cp -p $file $file.new
-echo "s:\$HTTPD -k \$ARGV:\$HTTPD -k \$ARGV -d ${HOME}/opt/jboss/httpd/httpd:" > sed.cmd
+echo "s:\$HTTPD -k \$ARGV:\$HTTPD -k \$ARGV -d ${BASELOC}/opt/jboss/httpd/httpd:" > sed.cmd
sed -f sed.cmd $file > $file.new
mv $file $file.`date +%y%m%d.%H%M%S`.1.org
mv $file.new $file
# Arrange httpd.conf
-file=$HOME/opt/jboss/httpd/httpd/conf/httpd.conf
+file=$BASELOC/opt/jboss/httpd/httpd/conf/httpd.conf
cp -p $file $file.new
echo "s/Listen 80/Listen @IP@:8000/" > sed.cmd
echo "s/LoadModule proxy_balancer/#LoadModule proxy_balancer/" >> sed.cmd
@@ -73,3 +167,7 @@
# replace httpd.conf by the new file.
mv $file $file.`date +%y%m%d.%H%M%S`.1.org
mv $file.new.1 $file
+
+# restore the execute permissions.
+chmod a+x $BASELOC/opt/jboss/httpd/sbin/*
+chmod a+x $BASELOC/opt/jboss/httpd/bin/*