Removed the references to "Java 2" from the description of the generated JRE package
[sven/java-package.git] / lib / oracle-jdk.sh
1 # Detect product
2 j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
3 oracle_j2sdk_detect() {
4   j2se_release=0
5
6   # Update or GA release (jdk-7u15-linux-i586.tar.gz)
7   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
8   then
9     j2se_release=${BASH_REMATCH[1]}
10     j2se_update=${BASH_REMATCH[3]}
11     j2se_arch=${BASH_REMATCH[4]}
12     if [[ $j2se_update != "" ]]
13     then
14       j2se_version_name="$j2se_release Update $j2se_update"
15       j2se_version=${j2se_release}u${j2se_update}
16     else
17       j2se_version_name="$j2se_release GA"
18       j2se_version=${j2se_release}
19     fi
20   fi
21
22   # Early Access Release (jdk-8-ea-bin-b103-linux-i586-15_aug_2013.tar.gz)
23   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-(ea|fcs)-bin-(b[0-9]+)-linux-(i586|x64|amd64).*\.(bin|tar\.gz) ]]
24   then
25     j2se_release=${BASH_REMATCH[1]}
26     j2se_update=${BASH_REMATCH[3]}
27     j2se_build=${BASH_REMATCH[5]}
28     j2se_arch=${BASH_REMATCH[6]}
29     if [[ $j2se_update != "" ]]
30     then
31       j2se_version_name="$j2se_release Update $j2se_update Early Access Release Build $j2se_build"
32       j2se_version=${j2se_release}u${j2se_update}~ea-build-${j2se_build}
33     else
34       j2se_version_name="$j2se_release Early Access Release Build $j2se_build"
35       j2se_version=${j2se_release}~ea-build-${j2se_build}
36     fi
37   fi
38
39   if [[ $j2se_release > 0 ]]
40   then
41     j2se_priority=$((310 + $j2se_release))
42     j2se_expected_min_size=130 #Mb
43
44     # check if the architecture matches
45     let compatible=1
46
47     case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
48       i386|i486-linux-gnu)
49         if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
50         ;;
51       amd64|x86_64-linux-gnu)
52         if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
53         ;;
54       armhf|armel|arm-linux-gnueabihf|arm-linux-gnueabi)
55       case "$archive_name" in
56         "jdk-7u"[0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
57             j2se_version=1.7.0+update${archive_name:6:1}${revision}
58             j2se_expected_min_size=100 #Mb
59             j2se_priority=317
60             found=true
61             ;;
62         "jdk-7u"[0-9][0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
63             j2se_version=1.7.0+update${archive_name:6:2}${revision}
64             j2se_expected_min_size=60 #Mb
65             j2se_priority=317
66             found=true
67             ;;
68       esac
69       ;;
70     esac
71
72     if [[ $compatible == 0 ]]
73     then
74       echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
75       return
76     fi
77     
78     
79     cat << EOF
80
81 Detected product:
82     Java(TM) Development Kit (JDK)
83     Standard Edition, Version $j2se_version_name
84     Oracle(TM)
85 EOF
86     if read_yn "Is this correct [Y/n]: "; then
87       j2se_found=true
88       j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
89       j2se_vendor="oracle"
90       j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)"
91
92       j2se_install=oracle_j2sdk_install
93       j2se_remove=oracle_j2sdk_remove
94       j2se_jinfo=oracle_j2sdk_jinfo
95       if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
96             oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
97         oracle_jre_bin_jre="policytool"
98       else
99         oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
100         oracle_jre_bin_jre="javaws policytool"
101       fi
102       if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
103             oracle_no_man_jre_bin_jre="ControlPanel"
104       fi
105       oracle_jre_lib_hl="jexec"
106       oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
107       j2sdk_run
108     fi
109   fi
110 }
111
112 oracle_j2sdk_install() {
113     cat << EOF
114 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
115     exit 0
116 fi
117
118 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
119 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
120 if [ -n "$oracle_no_man_jre_bin_jre" ]; then
121     install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
122 fi
123 install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
124 install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
125
126 # No plugin for ARM architecture yet
127 if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
128 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
129 for b in $browser_plugin_dirs;do
130             install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
131 done
132 fi
133 EOF
134 }
135
136 oracle_j2sdk_remove() {
137     cat << EOF
138 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
139     exit 0
140 fi
141
142 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
143 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
144 if [ -n "$oracle_no_man_jre_bin_jre" ]; then
145     remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
146 fi
147 remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
148 remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
149
150 # No plugin for ARM architecture yet
151 if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
152 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
153 for b in $browser_plugin_dirs;do
154     remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
155 done
156 fi
157 EOF
158 }
159
160 oracle_j2sdk_jinfo() {
161     cat << EOF
162 name=$j2se_name
163 priority=$j2se_priority
164 section=main
165 EOF
166     jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
167     jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
168     if [ -n "$oracle_no_man_jre_bin_jre" ]; then
169         jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
170     fi
171     jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
172     jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
173     if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
174         for b in $browser_plugin_dirs;do
175             echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
176         done
177     fi
178 }