wok-next view get-java6-jre/stuff/get-java6-jre @ rev 16437
Add svkbd-fr (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Apr 18 12:03:42 2014 +0000 (2014-04-18) |
parents | 2bc0db3c104a |
children | 6fab3264ba87 |
line source
1 #!/bin/sh
2 # Get and install the SUN Java Runtime Environnement
3 #
4 # (C) 2007-2012 SliTaz - GNU General Public License v3.
5 #
6 # Author : Eric Joseph-Alexandre <erjo@slitaz.org>
8 PACKAGE="java6-jre"
9 WEB_SITE="http://www.java.com/"
10 SHORT_DESC="SUN Java Runtime."
11 DEPENDS="xorg-libXtst"
12 TARBALL="jre.bin"
13 TEMP_DIR="/tmp/$PACKAGE.$$"
14 ROOT="$1"
16 URL="$(wget -O - ${WEB_SITE}en/download/manual_v6.jsp | \
17 sed '/self-extracting/!d;s/.*href="\([^"]*\).*/\1/;q')"
19 # Check if we are root starting anything
20 if test $(id -u) != 0 ; then
21 echo -e "\nYou must be root to run `basename $0`."
22 echo -e "Please type 'su' and root password to become super-user.\n"
23 exit 1
24 fi
26 # Avoid reinstall
27 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
28 echo -e "\n$PACKAGE package is already installed.\n"
29 exit 1
30 fi
34 # Create TEMP_DIR
35 CUR_DIR=$(pwd)
36 test -d $TEMP_DIR || mkdir $TEMP_DIR
37 cd $TEMP_DIR
39 # Download the file
40 test -f $TARBALL || wget $URL -O $TARBALL
41 if [ ! -f $TARBALL ]; then
42 cd $CUR_DIR
43 rm -rf $TEMP_DIR
44 echo "Could not download $TARBALL. Exiting."
45 exit 1
46 fi
48 # Do not trust 'df' free space
49 sed -i 's/exit 3$//' $TARBALL
51 # Run the install file user may agree to SUN EULA
52 chmod +x $TARBALL
53 sh ${TARBALL}
56 # Make the package
57 VERSION="$(ls jre?.* -d | sed 's/^jre//')"
58 mkdir -p $PACKAGE-$VERSION/fs/usr/lib/java
59 # use mv instead of 'cp -a' to save RAM
60 mv jre${VERSION} $PACKAGE-$VERSION/fs/usr/lib/java
62 # extracted pkg can be removed: Save RAM
63 rm -rf $TARBALL
65 #delete unecessary files
66 rm -rf $PACKAGE-$VERSION/fs/usr/lib/java/jre${VERSION}/man
68 # Create receipt
70 cat > $PACKAGE-$VERSION/receipt <<EOT
71 # SliTaz package receipt.
73 PACKAGE="$PACKAGE"
74 VERSION="$VERSION"
75 CATEGORY="non-free"
76 SHORT_DESC="$SHORT_DESC"
77 DEPENDS="$DEPENDS"
78 WEB_SITE="$WEB_SITE"
80 post_install()
81 {
82 echo -n "Processing post install commands..."
83 [ -d /usr/lib/mozilla/plugins ] || mkdir -p /usr/lib/mozilla/plugins
84 ln -s /usr/lib/java/jre\$VERSION/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins
86 cd /usr/bin
87 ln -s /usr/lib/java/jre\$VERSION/bin/java
88 status
89 }
91 post_remove()
92 {
93 rm -f /usr/lib/mozilla/plugins/libnpjp2.so
94 rm -f /usr/bin/java
95 }
96 EOT
98 # Pack
99 tazpkg pack $PACKAGE-$VERSION
101 # Clean to save RAM memory
102 rm -rf $PACKAGE-$VERSION
104 # Install pseudo package
105 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
106 case " $@ " in
107 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
108 esac
110 # Clean
111 cd $CUR_DIR
112 rm -rf $TEMP_DIR