Basic support for Java 10
[sven/java-package.git] / lib / oracle-server-jre.sh
1 # Detect product
2 j2se_detect_oracle_server_j2re=oracle_server_j2re_detect
3 oracle_server_j2re_detect() {
4   j2se_release=0
5
6   # JRE 9 GA release (serverjre-9.0.1_linux-x64_bin.tar.gz)
7   if [[ $archive_name =~ ^serverjre-9(\.([0-9]+)\.([0-9]+))?_linux-x64_bin\.tar\.gz ]]
8   then
9       j2se_release=9
10       j2se_update=${BASH_REMATCH[1]:-.0.0}
11       j2se_arch=x64
12       j2se_version_name="${j2se_release} version ${j2se_release}${j2se_update}"
13       j2se_version=${j2se_release}${j2se_update}${revision}
14   fi
15
16   # Update or GA release (server-jre-8u74-linux-x64.tar.gz)
17   if [[ $archive_name =~ server-jre-([0-8]+)(u([0-9]+))?-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
18   then
19     j2se_release=${BASH_REMATCH[1]}
20     j2se_update=${BASH_REMATCH[3]}
21     j2se_arch=${BASH_REMATCH[4]}
22     if [[ $j2se_update != "" ]]
23     then
24       j2se_version_name="$j2se_release Update $j2se_update"
25       j2se_version=${j2se_release}u${j2se_update}${revision}
26     else
27       j2se_version_name="$j2se_release GA"
28       j2se_version=${j2se_release}${revision}
29     fi
30   fi
31
32   # Early Access Release (jre-8-ea-bin-b103-linux-x64-15_aug_2013.tar.gz)
33   if [[ $archive_name =~ server-jre-([0-8]+)(u([0-9]+))?-(ea|fcs)-bin-(b[0-9]+)-linux-(i586|x64|amd64).*\.(bin|tar\.gz) ]]
34   then
35     j2se_release=${BASH_REMATCH[1]}
36     j2se_update=${BASH_REMATCH[3]}
37     j2se_build=${BASH_REMATCH[5]}
38     j2se_arch=${BASH_REMATCH[6]}
39     if [[ $j2se_update != "" ]]
40     then
41       j2se_version_name="$j2se_release Update $j2se_update Early Access Release Build $j2se_build"
42       j2se_version=${j2se_release}u${j2se_update}~ea-build-${j2se_build}${revision}
43     else
44       j2se_version_name="$j2se_release Early Access Release Build $j2se_build"
45       j2se_version=${j2se_release}~ea-build-${j2se_build}${revision}
46     fi
47   fi
48
49   if [[ $j2se_release > 0 ]]
50   then
51     j2se_priority=$((310 + $j2se_release - 1))
52     j2se_expected_min_size=85 #Mb
53
54     # check if the architecture matches
55     let compatible=1
56
57     case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
58       i386|i486-linux-gnu)
59         if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
60         ;;
61       amd64|x86_64-linux-gnu)
62         if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
63         ;;
64     esac
65
66     if [[ $compatible == 0 ]]
67     then
68       echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
69       return
70     fi
71
72
73     cat << EOF
74
75 Detected product:
76     Server Java(TM) Runtime Environment (JRE)
77     Standard Edition, Version $j2se_version_name
78     Oracle(TM)
79 EOF
80     if read_yn "Is this correct [Y/n]: "; then
81       j2se_found=true
82       j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
83       j2se_vendor="oracle"
84       j2se_title="Java Platform, Standard Edition $j2se_release Server Runtime Environment"
85
86       j2se_install=oracle_server_j2re_install
87       j2se_remove=oracle_server_j2re_remove
88       j2se_jinfo=oracle_server_j2re_jinfo
89       j2se_control=oracle_server_j2re_control
90       oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
91       oracle_jre_bin_jre="policytool"
92       oracle_jre_lib_hl="jexec"
93       j2se_package="$j2se_vendor-java$j2se_release-server-jre"
94       exlude_libs="appletviewer libawt_xawt.so libsplashscreen.so policytool"
95       j2se_run
96     fi
97   fi
98 }
99
100 oracle_server_j2re_install() {
101     cat << EOF
102 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
103     exit 0
104 fi
105
106 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
107 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
108 install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
109 EOF
110 }
111
112 oracle_server_j2re_remove() {
113     cat << EOF
114 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
115     exit 0
116 fi
117
118 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
119 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
120 remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
121 EOF
122 }
123
124 oracle_server_j2re_jinfo() {
125     cat << EOF
126 name=$j2se_name
127 priority=${priority_override:-$j2se_priority}
128 section=main
129 EOF
130     jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl
131     jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_jre_bin_jre
132     jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
133 }
134
135 oracle_server_j2re_control() {
136     j2se_control
137     if [ "$create_cert_softlinks" == "true" ]; then
138         depends="ca-certificates-java"
139     fi
140     for i in `seq 5 ${j2se_release}`;
141     do
142         provides_headless="${provides_headless} java${i}-runtime-headless,"
143     done
144     cat << EOF
145 Package: $j2se_package
146 Architecture: $j2se_debian_arch
147 Depends: \${misc:Depends}, \${shlibs:Depends}, java-common, $depends
148 Recommends: netbase
149 Provides: java-runtime-headless, java2-runtime-headless, $provides_headless
150 Description: $j2se_title
151  The Java(TM) SE Server Runtime Environment contains the Java virtual machine,
152  runtime class libraries, and Java application launcher that are necessary to
153  run programs written in the Java programming language. It includes tools for
154  JVM monitoring and tools commonly required for server applications, but does
155  not include browser integration (the Java plug-in), auto-update, nor an
156  installer.
157  .
158  This package has been automatically created with java-package ($version).
159 EOF
160 }