get-scripts diff openoffice3 @ rev 4

Fix bug 79: get-LibreOffice get-OpenOffice3 packages shoud not have capital letter on their names.
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 16 20:20:05 2014 +0000 (2014-02-16)
parents
children 8b66f6a75a05
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openoffice3	Sun Feb 16 20:20:05 2014 +0000
     1.3 @@ -0,0 +1,165 @@
     1.4 +#!/bin/sh
     1.5 +# get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite.
     1.6 +#
     1.7 +# (C) 2008 SliTaz - GNU General Public License v3.
     1.8 +#
     1.9 +# Author : Eric Joseph-Alexandre <erjo@slitaz.org>
    1.10 +
    1.11 +PACKAGE="OpenOffice3"
    1.12 +URL="http://www.openoffice.org"
    1.13 +PATTERN="Linux_x86_install-rpm"
    1.14 +
    1.15 +for MIRROR in \
    1.16 +http://mirror.switch.ch/ftp/mirror/OpenOffice \
    1.17 +http://openoffice.cict.fr \
    1.18 +http://wwwftp.ciril.fr/pub/openoffice \
    1.19 +http://artfiles.org/openoffice.org \
    1.20 +http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \
    1.21 +http://ftp.ntua.gr/pub/OpenOffice \
    1.22 +http://ftp.iitm.ac.in/openoffice \
    1.23 +http://www.ring.gr.jp/archives/misc/openoffice \
    1.24 +http://ftp.nluug.nl/pub/office/openoffice \
    1.25 +
    1.26 +do
    1.27 +	wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue
    1.28 +	DIR="stable"
    1.29 +	LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \
    1.30 +		grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \
    1.31 +		head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
    1.32 +	[ -n "$LOC" ] && DIR="localized/$LOC"
    1.33 +	VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \
    1.34 +	href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)"
    1.35 +	[ -n "$VERSION" ] && break
    1.36 +done
    1.37 +
    1.38 +if [ -z "$VERSION" ]; then
    1.39 +	abort_package "Can't find VERSION. Abort."
    1.40 +fi
    1.41 +echo "Selecting $DIR version $VERSION ..."
    1.42 +TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
    1.43 +	2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
    1.44 +echo "Archive is $TARBALL ..."
    1.45 +WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
    1.46 +
    1.47 +TEMP_DIR="/tmp/$PACKAGE.$$"
    1.48 +CUR_DIR=$(pwd)
    1.49 +SOURCE_DIR="/tmp/src.$$"
    1.50 +EXCLUDE="kde|gnome|test"
    1.51 +LOG="/tmp/$(basename $0 .sh).log"
    1.52 +
    1.53 +# Check if we have the tarball before.
    1.54 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    1.55 +	echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
    1.56 +	#Check if $SOURCE_DIR exist
    1.57 +	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    1.58 +	# Get the file.
    1.59 +	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    1.60 +	status
    1.61 +fi
    1.62 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    1.63 +	rm -rf $SOURCE_DIR
    1.64 +	abort_package "Could not download $TARBALL. Exiting."
    1.65 +fi
    1.66 +
    1.67 +# Creates TEMP_DIR and extract tarball
    1.68 +mkdir -p $TEMP_DIR
    1.69 +echo -n "Extract files from archive..."
    1.70 +tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 ||
    1.71 + abort_package "Failed to extract $TARBALL"
    1.72 +status
    1.73 +
    1.74 +# extracted pkg can be removed: Save RAM
    1.75 +rm -rf $SOURCE_DIR
    1.76 +
    1.77 +cd $TEMP_DIR/*/RPMS
    1.78 +
    1.79 +# Extract everything from RPMS
    1.80 +for i in *.rpm
    1.81 +do
    1.82 +	if (! echo $i | egrep -qi $EXCLUDE); then
    1.83 +		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    1.84 +	fi
    1.85 +done
    1.86 +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
    1.87 +	
    1.88 +# extracted pkg can be removed: Save RAM
    1.89 +rm -f desktop-integration/*freedesktop*.rpm
    1.90 +
    1.91 +
    1.92 +# Make the package
    1.93 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice  \
    1.94 +  $PACKAGE-$VERSION/fs/usr/share
    1.95 +
    1.96 +# use mv instead of 'cp -a' to save RAM
    1.97 +mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
    1.98 +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
    1.99 +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   1.100 +mv usr/bin $PACKAGE-$VERSION/fs/usr
   1.101 +
   1.102 +# relocalized OOo libexec directory
   1.103 +sed -i 's#/opt/#/usr/lib/openoffice/#'  $PACKAGE-$VERSION/fs/usr/bin/openoffice*
   1.104 +
   1.105 +# Create receipt
   1.106 +cat > $PACKAGE-$VERSION/receipt <<EOT
   1.107 +# SliTaz package receipt.
   1.108 +
   1.109 +PACKAGE="$PACKAGE"
   1.110 +VERSION="$VERSION"
   1.111 +CATEGORY="office"
   1.112 +SHORT_DESC="Productivity suite."
   1.113 +DEPENDS="java-jre"
   1.114 +WEB_SITE="$URL"
   1.115 +
   1.116 +post_install()
   1.117 +{
   1.118 +	cd \$1/usr/share/applications
   1.119 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop 
   1.120 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
   1.121 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
   1.122 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
   1.123 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
   1.124 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
   1.125 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
   1.126 +	
   1.127 +	cd \$1/usr/bin
   1.128 +	ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
   1.129 +}
   1.130 +
   1.131 +post_remove()
   1.132 +{
   1.133 +	rm -f \$1/usr/share/applications/openoffice.org3-*
   1.134 +}
   1.135 +
   1.136 +EOT
   1.137 +
   1.138 +fake_install()
   1.139 +{
   1.140 +	mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
   1.141 +	echo "00000000000000000000000000000000  $PACKAGE-$VERSION.tazpkg" >> \
   1.142 +		$ROOT/var/lib/tazpkg/installed.md5
   1.143 +	[ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   1.144 +	( cd fs ; find *) | sed 's|^|/|' > \
   1.145 +		$ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
   1.146 +	if grep -q ^CONFIG_FILES= $1/receipt ; then
   1.147 +		cd fs
   1.148 +		find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
   1.149 +			cpio -o -H newc | gzip -9 > \
   1.150 +			$ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
   1.151 +		for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
   1.152 +			[ -e $ROOT$i ] && rm -rf .$i
   1.153 +		done
   1.154 +		cd ..
   1.155 +	fi
   1.156 +	sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
   1.157 +		$1/receipt
   1.158 +	cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   1.159 +	echo "Compute md5sum..."
   1.160 +	find fs -type f | xargs md5sum | sed 's|  fs/|  /|' > \
   1.161 +		$ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
   1.162 +	echo "Move files..."
   1.163 +	( cd $1/fs ; find ) | while read file ; do 
   1.164 +		[ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
   1.165 +		mv $1/fs/$file $(dirname $ROOT/$file)
   1.166 +	done
   1.167 +}
   1.168 +set +e