]> git.sven.stormbind.net Git - sven/java-package.git/blob - lib/oracle-jre.sh
Updated debian/README.Debian
[sven/java-package.git] / lib / oracle-jre.sh
1 # Detect product
2 j2se_detect_oracle_j2re=oracle_j2re_detect
3 oracle_j2re_detect() {
4   j2se_release=0
5
6   # Update or GA release (jre-7u13-linux-x64.tar.gz)
7   if [[ $archive_name =~ jre-([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 (jre-8-ea-bin-b103-linux-x64-15_aug_2013.tar.gz)
23   if [[ $archive_name =~ jre-([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 - 1))
42     j2se_expected_min_size=85 #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     esac
55
56     if [[ $compatible == 0 ]]
57     then
58       echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
59       return
60     fi
61
62
63     cat << EOF
64
65 Detected product:
66     Java(TM) Runtime Environment (JRE)
67     Standard Edition, Version $j2se_version_name
68     Oracle(TM)
69 EOF
70     if read_yn "Is this correct [Y/n]: "; then
71       j2se_found=true
72       j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
73       j2se_vendor="oracle"
74       j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)"
75
76       j2se_install=oracle_j2re_install
77       j2se_remove=oracle_j2re_remove
78       j2se_jinfo=oracle_j2re_jinfo
79       oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
80       oracle_jre_bin_jre="javaws policytool"
81       oracle_no_man_jre_bin_jre="ControlPanel"
82       oracle_jre_lib_hl="jexec"
83       j2re_run
84     fi
85   fi
86 }
87
88 oracle_j2re_install() {
89     cat << EOF
90 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
91     exit 0
92 fi
93
94 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
95 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
96 install_no_man_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
97 install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
98
99 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
100 for b in $browser_plugin_dirs;do
101     install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
102 done
103 EOF
104 }
105
106 oracle_j2re_remove() {
107     cat << EOF
108 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
109     exit 0
110 fi
111
112 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
113 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
114 remove_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
115 remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
116
117 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
118 for b in $browser_plugin_dirs;do
119     remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
120 done
121 EOF
122 }
123
124 oracle_j2re_jinfo() {
125     cat << EOF
126 name=$j2se_name
127 priority=$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 "jre" $jvm_base$j2se_name/bin/ $oracle_no_man_jre_bin_jre
133     jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
134     for b in $browser_plugin_dirs;do
135         echo "plugin $b-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
136     done
137 }
138