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