Remove UTF-8 trademark symbol from package description
[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}${revision}
16     else
17       j2se_version_name="$j2se_release GA"
18       j2se_version=${j2se_release}${revision}
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}${revision}
33     else
34       j2se_version_name="$j2se_release Early Access Release Build $j2se_build"
35       j2se_version=${j2se_release}~ea-build-${j2se_build}${revision}
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 Platform, Standard Edition $j2se_release Runtime Environment"
75
76       j2se_install=oracle_j2re_install
77       j2se_remove=oracle_j2re_remove
78       j2se_jinfo=oracle_j2re_jinfo
79       j2se_control=oracle_j2re_control
80       oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
81       oracle_jre_bin_jre="javaws policytool"
82       oracle_no_man_jre_bin_jre="ControlPanel jcontrol"
83       oracle_jre_lib_hl="jexec"
84       j2se_package="$j2se_vendor-java$j2se_release-jre"
85       j2se_run
86     fi
87   fi
88 }
89
90 oracle_j2re_install() {
91     cat << EOF
92 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
93     exit 0
94 fi
95
96 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
97 install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
98 install_no_man_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
99 install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
100
101 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
102 for b in $browser_plugin_dirs;do
103     install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
104 done
105 EOF
106 }
107
108 oracle_j2re_remove() {
109     cat << EOF
110 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
111     exit 0
112 fi
113
114 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
115 remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
116 remove_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
117 remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
118
119 plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
120 for b in $browser_plugin_dirs;do
121     remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
122 done
123 EOF
124 }
125
126 oracle_j2re_jinfo() {
127     cat << EOF
128 name=$j2se_name
129 priority=$j2se_priority
130 section=main
131 EOF
132     jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl
133     jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_jre_bin_jre
134     jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_no_man_jre_bin_jre
135     jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
136     for b in $browser_plugin_dirs;do
137         echo "plugin $b-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
138     done
139 }
140
141 oracle_j2re_control() {
142     j2se_control
143     if [ "$create_cert_softlinks" == "true" ]; then
144         depends="ca-certificates-java"
145     fi
146     for i in `seq 5 ${j2se_release}`;
147     do
148         provides_runtime="${provides_runtime} java${i}-runtime,"
149         provides_headless="${provides_headless} java${i}-runtime-headless,"
150     done
151     cat << EOF
152 Package: $j2se_package
153 Architecture: $j2se_debian_arch
154 Depends: \${misc:Depends}, \${shlibs:Depends}, $depends
155 Recommends: netbase
156 Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime java-runtime-headless, java2-runtime-headless, $provides_headless java-browser-plugin
157 Description: $j2se_title
158  The Java(TM) SE Runtime Environment contains the Java virtual machine,
159  runtime class libraries, and Java application launcher that are
160  necessary to run programs written in the Java programming language.
161  It is not a development environment and does not contain development
162  tools such as compilers or debuggers.  For development tools, see the
163  Java SE Development Kit (JDK).
164  .
165  This package has been automatically created with java-package ($version).
166 EOF
167 }