1532a7dcb3eac85d257dc12096b5ca649b5bb51e
[sven/java-package.git] / lib / oracle-jdk-doc.sh
1 # Detect product
2 oracle_j2sdk_doc_detect() {
3   j2se_release=0
4
5   # Update or GA release (jdk-7u25-apidocs.zip)
6   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-(apidocs|docs-all)\.zip ]]
7   then
8     j2se_release=${BASH_REMATCH[1]}
9     j2se_update=${BASH_REMATCH[3]}
10     if [[ $j2se_update != "" ]]
11     then
12       j2se_version_name="$j2se_release Update $j2se_update"
13       j2se_version=${j2se_release}u${j2se_update}${revision}
14     else
15       j2se_version_name="$j2se_release GA"
16       j2se_version=${j2se_release}${revision}
17     fi
18   fi
19
20   # Early Access Release (jdk-8-ea-docs-b104-all-21_aug_2013.zip)
21   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-(ea|fcs)-docs-(b[0-9]+)-all.*\.zip ]]
22   then
23     j2se_release=${BASH_REMATCH[1]}
24     j2se_update=${BASH_REMATCH[3]}
25     j2se_build=${BASH_REMATCH[5]}
26     if [[ $j2se_update != "" ]]
27     then
28       j2se_version_name="$j2se_release Update $j2se_update Early Access Release Build $j2se_build"
29       j2se_version=${j2se_release}u${j2se_update}~ea-build-${j2se_build}${revision}
30     else
31       j2se_version_name="$j2se_release Early Access Release Build $j2se_build"
32       j2se_version=${j2se_release}~ea-build-${j2se_build}${revision}
33     fi
34   fi
35
36   if [[ $j2se_release > 0 ]]
37   then
38     case "$j2se_release" in
39     6) # JDK 6
40       j2se_expected_min_size=44 #Mb
41       ;;
42     7) # JDK 7
43       j2se_expected_min_size=290 #Mb
44       ;;
45     *) # JDK 8 and higher
46       j2se_expected_min_size=320 #Mb
47       ;;
48
49     esac
50
51     cat << EOF
52
53 Detected product:
54     Java(TM) Development Kit (JDK) Documentation
55     Standard Edition, Version $j2se_version_name
56     Oracle(TM)
57 EOF
58     if read_yn "Is this correct [Y/n]: "; then
59       j2se_found=true
60       j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
61       j2se_vendor="oracle"
62       j2se_title="Java™ Platform, Standard Edition $j2se_release Documentation"
63
64       j2se_install=oracle_j2sdk_doc_install
65       j2se_remove=oracle_j2sdk_doc_remove
66       j2sdk_doc_run
67     fi
68   fi
69 }
70
71 j2se_detect_j2sdk_doc_oracle=oracle_j2sdk_doc_detect
72
73 oracle_j2sdk_doc_install() {
74     cat << EOF
75 if [ ! -e "$javadoc_base$j2se_name" ]; then
76     exit 0
77 fi
78
79 # Register the documentation in the various documentation systems, i.e. dhelp and dwww.
80 if [ "\$1" = configure ] ; then
81     if which install-docs >/dev/null 2>&1; then
82         install-docs -i $javadoc_base$j2se_name
83     fi
84 fi
85 EOF
86 }
87
88 oracle_j2sdk_doc_remove() {
89     cat << EOF
90 if [ ! -e "$javadoc_base$j2se_name" ]; then
91     exit 0
92 fi
93
94 # Unregister documentation from the various documentation systems, i.e. dhelp and dwww.
95 if [ "\$1" = configure ] ; then
96     if which install-docs >/dev/null 2>&1; then
97         install-docs -r $javadoc_base$j2se_name
98     fi
99 fi
100 EOF
101 }
102