You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2012/02/21 12:55:21 UTC

svn commit: r1291723 - in /whirr/trunk: CHANGES.txt core/src/main/resources/functions/install_oab_java.sh

Author: asavu
Date: Tue Feb 21 11:55:20 2012
New Revision: 1291723

URL: http://svn.apache.org/viewvc?rev=1291723&view=rev
Log:
WHIRR-520. Using OAB script to install sun jdk (Marco Didonna via asavu)

Added:
    whirr/trunk/core/src/main/resources/functions/install_oab_java.sh
Modified:
    whirr/trunk/CHANGES.txt

Modified: whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1291723&r1=1291722&r2=1291723&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Tue Feb 21 11:55:20 2012
@@ -92,6 +92,8 @@ Trunk (unreleased changes)
     WHIRR-510. Get ZooKeeper ensemble with internal addresses 
     (David Arthur via asavu)
 
+    WHIRR-520. Using OAB script to install sun jdk (Marco Didonna via asavu)
+
 Release 0.7.0 - 2011-12-11
 
   NEW FEATURES

Added: whirr/trunk/core/src/main/resources/functions/install_oab_java.sh
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/main/resources/functions/install_oab_java.sh?rev=1291723&view=auto
==============================================================================
--- whirr/trunk/core/src/main/resources/functions/install_oab_java.sh (added)
+++ whirr/trunk/core/src/main/resources/functions/install_oab_java.sh Tue Feb 21 11:55:20 2012
@@ -0,0 +1,71 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+function install_oab_java_deb() {
+  # Enable multiverse
+  # TODO: check that it is not already enabled
+  sed -i -e 's/universe$/universe multiverse/' /etc/apt/sources.list
+  
+  DISTRO=`lsb_release -s -c`
+  
+  apt-get update
+  
+  wget https://raw.github.com/flexiondotorg/oab-java6/master/oab-java6.sh -O oab-java6.sh
+  chmod +x oab-java6.sh
+  ./oab-java6.sh
+  
+  apt-get update
+  
+  apt-get -y --allow-unauthenticated install sun-java6-jdk
+  
+  echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun" >> /etc/profile
+  echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun" >> ~root/.bashrc
+  export JAVA_HOME=/usr/lib/jvm/java-6-sun
+  java -version
+  
+}
+
+function install_oab_java_rpm() {
+  MACHINE_TYPE=`uname -m`
+  if [ ${MACHINE_TYPE} == 'x86_64' ]; then
+    JDK_PACKAGE=jdk-6u21-linux-x64-rpm.bin
+  else
+    JDK_PACKAGE=jdk-6u21-linux-i586-rpm.bin
+  fi
+  JDK_INSTALL_PATH=/usr/java
+  mkdir -p $JDK_INSTALL_PATH
+  cd $JDK_INSTALL_PATH
+  wget http://whirr-third-party.s3.amazonaws.com/$JDK_PACKAGE
+  chmod +x $JDK_PACKAGE
+  mv /bin/more /bin/more.no
+  yes | ./$JDK_PACKAGE -noregister
+  mv /bin/more.no /bin/more
+  rm -f *.rpm $JDK_PACKAGE
+  
+  export JAVA_HOME=$(ls -d $JDK_INSTALL_PATH/jdk*)
+  echo "export JAVA_HOME=$JAVA_HOME" >> /etc/profile
+  alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 17000
+  alternatives --set java $JAVA_HOME/bin/java
+  java -version
+}
+
+function install_oab_java() {
+  if which dpkg &> /dev/null; then
+    install_oab_java_deb
+  elif which rpm &> /dev/null; then
+    install_oab_java_rpm
+  fi
+}