]> git.sven.stormbind.net Git - sven/java-package.git/blob - lib/oracle-j2sdk.sh
Replaced j2re and j2sdk by jre and jdk in the name of the generated packages
[sven/java-package.git] / lib / oracle-j2sdk.sh
1 # Detect product
2 j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
3 oracle_j2sdk_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         "jdk-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=130 #Mb
12             j2se_priority=315
13             found=true
14             ;;
15         "jdk-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=190 #Mb
18             j2se_priority=317
19             found=true
20             ;;
21       esac
22       ;;
23     amd64|x86_64-linux-gnu)
24       case "$archive_name" in
25         "jdk-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=130 #Mb
28             j2se_priority=315
29             found=true
30             ;;
31         "jdk-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=180 #Mb
34             j2se_priority=317
35             found=true
36             ;;
37       esac
38       ;;
39   esac
40   if [[ -n "$found" ]]; then
41         cat << EOF
42
43 Detected product:
44     Java(TM) Development Kit (JDK)
45     Standard Edition, Version $j2se_version
46     Oracle(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) JDK, Standard Edition, Oracle(TM)"
54
55             j2se_install=oracle_j2sdk_install
56             j2se_remove=oracle_j2sdk_remove
57             j2se_jinfo=oracle_j2sdk_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             oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
63             j2sdk_run
64         fi
65     fi
66 }
67
68 oracle_j2sdk_install() {
69         cat << EOF
70 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
71     exit 0
72 fi
73
74 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
75 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
76 install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
77 install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
78 install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
79
80 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
81 install_browser_plugin "/usr/lib/iceweasel/plugins" "libjavaplugin.so" "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
82 install_browser_plugin "/usr/lib/chromium/plugins" "libjavaplugin.so" "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
83 EOF
84 }
85
86 oracle_j2sdk_remove() {
87         cat << EOF
88 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
89     exit 0
90 fi
91
92 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
93 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
94 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
95 remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
96 remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
97
98 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
99 remove_browser_plugin "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
100 remove_browser_plugin "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
101 EOF
102 }
103
104 oracle_j2sdk_jinfo() {
105     cat << EOF
106 name=$j2se_name
107 priority=$j2se_priority
108 section=main
109 EOF
110     jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
111     jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
112     jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
113     jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
114     jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
115     echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
116     echo "plugin chromium-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
117 }