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