summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-discuss/attachments/20111125/34b5f687/attachment.ksh
blob: a1e918a22ed3c81a783ea5669638e02bf760b7ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Name:           get-sun-java
Version:        1.6.0_29
Release:        %mkrel 1
Url:            http://www.java.com/en/download/
# Java test http://java.com/en/download/testjava.jsp
License:        Proprietary
Summary:        Download and Install Sun-Java
Group:          System/Libraries

# Allow 64bit users to install the 32bit version which 
# has features not included in the 64bit version
%if %{_arch} == x86_64
%define downloadurl http://javadl.sun.com/webapps/download/AutoDL?BundleId=56692
%define md5     4ef7f348e6190fd780e028a08a84b39c
%define binfile AutoDL?BundleId=56692
%define libarch amd64
%else
%define downloadurl     http://javadl.sun.com/webapps/download/AutoDL?BundleId=56690
%define md5     fcdf57daf2585b279df627b69fc96049
%define binfile AutoDL?BundleId=56690
%define libarch i386
%endif
%define tmp_download_dir        %{_localstatedir}/lib/%{name}
Requires:       wget
Obsoletes:      java-1.6.0-sun <= 1.6.0
Obsoletes:      java-1.6.0-openjdk <= 1.6.0

%description
This is an installer for Sun-Java-%{version}.
This package does not contain any program files as the Sun license no
longer allows distribution. By installing this package you will
download and install Sun-Java from sun.com.
Use the 32-bit version for Java applet and Java Web Start support.
You must accept the Java EULA before using it.
Please be patient, this is a 20 MB download and may take some time.
Removing this package will remove Sun-Java from your system.

%pre
mkdir -p %{tmp_download_dir}
[[ -d %{tmp_download_dir} ]] || exit 1
cd %{tmp_download_dir} || exit 1

if [[ -f %{binfile} ]]; then
:
else
wget --force-clobber --timeout=30 --tries=3 "%{downloadurl}"
[[ -f %{binfile} ]] || { echo "Download failed"; rm -r %{tmp_download_dir}; exit 1; }
fi
md5chk=$(md5sum %{binfile} | cut -d' ' -f1)
[[ %{md5} = $md5chk ]] || { echo "Download checksum failed"; rm %{binfile};\
cd ..; rm -r %{tmp_download_dir}; exit 1; }

%post
mkdir -p %{_datadir}/java
cd %{_datadir}/java
chmod +x %{tmp_download_dir}/%{binfile}
%{tmp_download_dir}/%{binfile} || exit 1
#rm -r %%{tmp_download_dir}
# Remove standard Firefox link
if [ -d %{_libdir}/mozilla/plugins ]; then
[ -f %{_libdir}/mozilla/plugins/libjavaplugin_oji.so ] && \
rm %{_libdir}/mozilla/plugins/libjavaplugin_oji.so

# Add Firefox plugin link
cd %{_libdir}/mozilla/plugins && ln -s %{_datadir}/java/jre%{version}/lib/%{libarch}/libnpjp2.so
fi

# ?
cd /etc/alternatives
ln -sf %{_datadir}/java/jre%{version}/bin/java

%preun
rm -rf %{_datadir}/java/jre%{version}
rm %{_libdir}/mozilla/plugins/libnpjp2.so

%files