Improved the detection of the JRE/JDK version (supports 2 digits Java 7 updates)...
[sven/java-package.git] / lib / oracle-j2sdk-doc.sh
1 # Detect product
2 oracle_j2sdk_doc_detect() {
3
4   if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-apidocs\.zip ]]
5   then
6     j2se_release=${BASH_REMATCH[1]}
7     j2se_update=${BASH_REMATCH[2]}
8     j2se_version=$j2se_release.$j2se_update
9     
10     case "$j2se_release" in
11     6) # JDK 6
12           j2se_expected_min_size=44 #Mb
13           ;;
14         *) # JDK 7 and higher
15           j2se_expected_min_size=290 #Mb
16           ;;
17     esac
18
19         cat << EOF
20
21 Detected product:
22     Java(TM) Development Kit (JDK) Documentation
23     Standard Edition, Version $j2se_release Update $j2se_update
24     Oracle(TM)
25 EOF
26         if read_yn "Is this correct [Y/n]: "; then
27             j2se_found=true
28             j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
29             j2se_vendor="oracle"
30             j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation"
31
32             j2se_install=oracle_j2sdk_doc_install
33             j2se_remove=oracle_j2sdk_doc_remove
34             j2sdk_doc_run
35         fi
36     fi
37 }
38
39 j2se_detect_j2sdk_doc_oracle=oracle_j2sdk_doc_detect
40
41 oracle_j2sdk_doc_install() {
42         cat << EOF
43 if [ ! -e "$javadoc_base$j2se_name" ]; then
44     exit 0
45 fi
46
47 # Register the documentation in the various documentation systems, i.e. dhelp and dwww.
48 if [ "\$1" = configure ] ; then
49     if which install-docs >/dev/null 2>&1; then
50         install-docs -i $javadoc_base$j2se_name
51     fi
52 fi
53 EOF
54 }
55
56 oracle_j2sdk_doc_remove() {
57         cat << EOF
58 if [ ! -e "$javadoc_base$j2se_name" ]; then
59     exit 0
60 fi
61
62 # Unregister documentation from the various documentation systems, i.e. dhelp and dwww.
63 if [ "\$1" = configure ] ; then
64     if which install-docs >/dev/null 2>&1; then
65         install-docs -r $javadoc_base$j2se_name
66     fi
67 fi
68 EOF
69 }
70