Advertisement
Guest User

Untitled

a guest
Feb 12th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. EXPECTED_JDK_RPM="${BASH_SOURCE%/*}/jdk.rpm"
  4. DL_RPM="http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.rpm"
  5.  
  6. if [ -e $EXPECTED_JDK_RPM ]
  7.   then
  8.     echo "$EXPECTED_JDK_RPM exists; installing it"
  9.   else
  10.     echo "$EXPECTED_JDK_RPM doesn't exist, attempting to download it. If you'd prefer to download it yourself, or if this operation fails, please supply the file and run this script again."
  11.     curl -sSf -L --cookie "oraclelicense=accept-securebackup-cookie" $DL_RPM > $EXPECTED_JDK_RPM
  12.  
  13.     if [ $? -ne 0 ]
  14.     then
  15.       echo "Download failed"
  16.       exit 1
  17.     fi
  18. fi
  19.  
  20. rpm -ivh --replacepkgs $EXPECTED_JDK_RPM
  21. echo -e 'export JAVA_HOME=/usr/java/latest\nexport PATH=$JAVA_HOME/bin:$PATH' >> /root/.profile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement