aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCNlukai <lukai1@huawei.com>2016-01-09 16:27:50 +0800
committerCNlukai <lukai1@huawei.com>2016-01-09 16:28:43 +0800
commitab0e02cb594d0a4e8920a6122d4a6e28954d2e8a (patch)
tree966c1fde75bb0cc239a91f2352f327b15fc477ae
parent2a6845a9cd188958bb622235bec026bb146eae39 (diff)
ONOSFW-156
Add build onos-package in onosfw Change-Id: I279762908cb0ebb4884a8f58709f1c2709109a26 Signed-off-by: CNlukai <lukai1@huawei.com>
-rwxr-xr-xautobuild.sh53
1 files changed, 44 insertions, 9 deletions
diff --git a/autobuild.sh b/autobuild.sh
index 119cdeeb..ac492d85 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -143,13 +143,49 @@ displayVersion()
# }
##### End Update ONOS #####
+##### Check Java Installed #####
+checkJava()
+{
+ INSTALLED_JAVA=`dpkg -l| grep jre | head -n 1`
+ if [ "$INSTALLED_JAVA" = "" ]; then
+ export JAVA_FLAG="False"
+ else
+ export JAVA_FLAG="True"
+ fi
+}
+##### End Check Java Installed #####
+
##### Check Java #####
checkJRE()
{
- INSTALLED_JAVA=`java -version 2>&1 | head -n 1 | cut -d\" -f 2` # | awk -F "." '{print $1"."$2}'`
- JAVA_NUM=`echo $INSTALLED_JAVA | awk -F "." '{print $1"."$2}'`
- if [ "$JAVA_NUM" '<' "$JAVA_VERSION" ]; then
- echo -e "Java version $INSTALLED_JAVA is lower than the required version of $JAVA_VERSION. \n"
+ if [ $JAVA_FLAG != "False" ]; then
+ INSTALLED_JAVA=`java -version 2>&1 | head -n 1 | cut -d\" -f 2` # | awk -F "." '{print $1"."$2}'`
+ JAVA_NUM=`echo $INSTALLED_JAVA | awk -F "." '{print $1"."$2}'`
+ if [ "$JAVA_NUM" '<' "$JAVA_VERSION" ]; then
+ echo -e "Java version $INSTALLED_JAVA is lower than the required version of $JAVA_VERSION. \n"
+ if [ "$OS" = "centos" ]; then
+ # printf "It is recommended that you run \"sudo yum -y install java-$JAVA_VERSION.0-openjdk-devel\".\n"
+ # if ask "May we perform this task for you?"; then
+ sudo yum -y install java-$JAVA_VERSION.0-openjdk-devel
+ # fi
+ elif [[ "$OS" = "ubuntu" ]]; then
+ # printf "It is recommended that you run \"sudo apt-get -y install openjdk-8-jdk\".\n"
+ # if ask "May we perform this task for you?"; then
+# sudo add-apt-repository ppa:openjdk-r/ppa
+ sudo apt-get update
+ sudo apt-get -y install openjdk-8-jdk
+ # fi
+
+ elif [[ "$OS" = "suse" ]]; then
+ # printf "It is recommended that you run \"sudo zypper --non-interactive install java-1_8_0-openjdk-devel\".\n"
+ # if ask "May we perform this task for you?"; then
+ sudo zypper --non-interactive install java-1_8_0-openjdk-devel
+ # fi
+ fi
+ else
+ printf "Installed Java version meets the requirements. \n\n"
+ fi
+ else
if [ "$OS" = "centos" ]; then
# printf "It is recommended that you run \"sudo yum -y install java-$JAVA_VERSION.0-openjdk-devel\".\n"
# if ask "May we perform this task for you?"; then
@@ -158,7 +194,7 @@ checkJRE()
elif [[ "$OS" = "ubuntu" ]]; then
# printf "It is recommended that you run \"sudo apt-get -y install openjdk-8-jdk\".\n"
# if ask "May we perform this task for you?"; then
- sudo add-apt-repository ppa:openjdk-r/ppa
+# sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get -y install openjdk-8-jdk
# fi
@@ -169,9 +205,7 @@ checkJRE()
sudo zypper --non-interactive install java-1_8_0-openjdk-devel
# fi
fi
- else
- printf "Installed Java version meets the requirements. \n\n"
- fi
+ fi
}
checkJDK()
@@ -187,7 +221,7 @@ checkJDK()
elif [[ "$OS" = "ubuntu" ]]; then
# printf "It doesn't look there's a valid JDK installed.\n"
# if ask "May we install one?"; then
- sudo add-apt-repository -y ppa:openjdk-r/ppa
+ # sudo add-apt-repository -y ppa:openjdk-r/ppa
sudo apt-get -y update
sudo apt-get -y install openjdk-8-jdk
# else
@@ -401,6 +435,7 @@ main()
displayVersion
detectOS
# updateONOS
+ checkJava
checkJRE
checkJDK
installAnt