]> git.sven.stormbind.net Git - sven/java-package.git/blob - lib/oracle-j2re.sh
Replaced j2re and j2sdk by jre and jdk in the name of the generated packages
[sven/java-package.git] / lib / oracle-j2re.sh
1 # Detect product
2 j2se_detect_oracle_j2re=oracle_j2re_detect
3 oracle_j2re_detect() {
4   local found=
5   
6   case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
7     i386|i486-linux-gnu)
8       case "$archive_name" in
9         "jre-6u"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
10             j2se_version=1.6.0+update${archive_name:6:2}${revision}
11             j2se_expected_min_size=16 #Mb
12             j2se_priority=314
13             found=true
14             ;;
15         "jre-7u"[0-9]"-linux-i586.tar.gz") # SUPPORTED
16             j2se_version=1.7.0+update${archive_name:6:1}${revision}
17             j2se_expected_min_size=94 #Mb
18             j2se_priority=316
19             found=true
20             ;;
21       esac
22       ;;
23     amd64|x86_64-linux-gnu)
24       case "$archive_name" in
25         "jre-6u"[0-9][0-9]"-linux-x64.bin") # SUPPORTED
26             j2se_version=1.6.0+update${archive_name:6:2}${revision}
27             j2se_expected_min_size=16 #Mb
28             j2se_priority=314
29             found=true
30             ;;
31         "jre-7u"[0-9]"-linux-x64.tar.gz") # SUPPORTED
32             j2se_version=1.7.0+update${archive_name:6:1}${revision}
33             j2se_expected_min_size=88 #Mb
34             j2se_priority=316
35             found=true
36             ;;
37       esac
38       ;;
39   esac
40   if [[ -n "$found" ]]; then
41         cat << EOF
42
43 Detected product:
44     Java(TM) Runtime Environment (JRE)
45     Standard Edition, Version $j2se_version
46     Oracle Microsystems(TM), Inc.
47 EOF
48         if read_yn "Is this correct [Y/n]: "; then
49             j2se_found=true
50             j2se_release="${j2se_version:0:3}"
51             j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
52             j2se_vendor="oracle"
53             j2se_title="Java(TM) JRE, Standard Edition, Oracle Microsystems(TM)"
54
55             j2se_install=oracle_j2re_install
56             j2se_remove=oracle_j2re_remove
57             j2se_jinfo=oracle_j2re_jinfo
58             oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
59             oracle_jre_bin_jre="javaws policytool"
60             oracle_no_man_jre_bin_jre="ControlPanel"
61             oracle_jre_lib_hl="jexec"
62             j2re_run
63         fi
64     fi
65 }
66
67 oracle_j2re_install() {
68         cat << EOF
69 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
70     exit 0
71 fi
72
73 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
74 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
75 install_no_man_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
76 install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
77
78 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
79 install_browser_plugin "/usr/lib/iceweasel/plugins" "libjavaplugin.so" "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
80 install_browser_plugin "/usr/lib/chromium/plugins" "libjavaplugin.so" "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
81 EOF
82 }
83
84 oracle_j2re_remove() {
85         cat << EOF
86 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
87     exit 0
88 fi
89
90 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
91 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
92 remove_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
93 remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
94
95 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
96 remove_browser_plugin "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
97 remove_browser_plugin "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
98 EOF
99 }
100
101 oracle_j2re_jinfo() {
102     cat << EOF
103 name=$j2se_name
104 priority=$j2se_priority
105 section=main
106 EOF
107     jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl
108     jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_jre_bin_jre
109     jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_no_man_jre_bin_jre
110     jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
111     echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
112     echo "plugin chromium-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
113 }
114