get-scripts 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 8398dd6c1c2c
children 5aedb6b0e87c
files LibreOffice OpenOffice3 libreoffice openoffice3
line diff
     1.1 --- a/LibreOffice	Sun Feb 16 20:08:16 2014 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,160 +0,0 @@
     1.4 -#!/bin/sh
     1.5 -# get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite.
     1.6 -#
     1.7 -# (C) 2010 SliTaz - GNU General Public License v3.
     1.8 -# Author : Ben Arnold <ben@seawolfsanctuary.com>
     1.9 -#    via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@slitaz.org>)
    1.10 -#
    1.11 -
    1.12 -PACKAGE="LibreOffice"
    1.13 -WEB_SITE="http://www.libreoffice.org"
    1.14 -CATEGORY="office"
    1.15 -SHORT_DESC="Productivity suite."
    1.16 -DEPENDS="cups"
    1.17 -SUGGESTED="java6-jre"
    1.18 -DIR="stable"
    1.19 -PREFIX="LibreOffice"
    1.20 -SUFFIX="Linux_x86_rpm.tar.gz"
    1.21 -WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR"
    1.22 -
    1.23 -VERSION="$(basename $(wget -O - $WGET_URL/ 2> /dev/null | \
    1.24 -	sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tail -1))"
    1.25 -if [ -z "$VERSION" ]; then
    1.26 -	abort_package "Can't detect an appropriate version. The version numbering or URL may have changed. Aborted."
    1.27 -fi
    1.28 -VER="${VERSION/\-/}" # without hyphens
    1.29 -
    1.30 -
    1.31 -TARBALL="${PREFIX}_${VER}_${SUFFIX}"
    1.32 -
    1.33 -for LOC in ${LANG/_/-} ${LANG%_*}; do
    1.34 -	L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
    1.35 -	L_TARBALL="${PREFIX}_${VER}_${L_SUFFIX}"
    1.36 -	LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
    1.37 -	busybox wget -s $LANG_URL 2> /dev/null || continue
    1.38 -	echo "Added $LANG ($LOC)."
    1.39 -	break
    1.40 -done
    1.41 -WGET_URL="$WGET_URL/${VERSION}/rpm/x86/${TARBALL}"
    1.42 -
    1.43 -CUR_DIR=$(pwd)
    1.44 -TEMP_DIR="/tmp/$PACKAGE.$$"
    1.45 -SOURCE_DIR="/tmp/src.$$"
    1.46 -EXCLUDE="kde|gnome|test"
    1.47 -LOG="/tmp/$(basename $0 .sh).log"
    1.48 -
    1.49 -# Check if we have the tarball before.
    1.50 -if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    1.51 -	echo "Downloading LibreOffice tarball (it's time to have a break)... "
    1.52 -	# Check if $SOURCE_DIR exist
    1.53 -	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    1.54 -	# Get the file.
    1.55 -	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    1.56 -	if [ -n $L_TARBALL ] ; then # Are we localised?
    1.57 -		wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
    1.58 -	fi
    1.59 -	status
    1.60 -fi
    1.61 -if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    1.62 -	rm -rf $SOURCE_DIR
    1.63 -	abort_package "Could not download $TARBALL. Exiting."
    1.64 -fi
    1.65 -
    1.66 -echo -n "Extracting files (this may take a while): "
    1.67 -
    1.68 -# Creates TEMP_DIR and extract tarball
    1.69 -mkdir -p $TEMP_DIR
    1.70 -for TB in $TARBALL $L_TARBALL ; do
    1.71 -	tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 ||
    1.72 -	abort_package "Failed to extract $TB"
    1.73 -done
    1.74 -
    1.75 -# Get version found in archive (often directory is still RC version when final is present)
    1.76 -ARCHIVED_VERSION=$(find $TEMP_DIR -type d 2> /dev/null | sed "/$PREFIX/!d;\$!d;s/_/ /g" | awk '{print $2}')
    1.77 -echo -n "(found v${ARCHIVED_VERSION})"
    1.78 -
    1.79 -# Consolidate localisations into main package
    1.80 -if [ -n $L_TARBALL ] ; then # Are we localised?
    1.81 -	  TARBALL_NAME="${TARBALL/.tar.gz/}"
    1.82 -	L_TARBALL_NAME="${L_TARBALL/.tar.gz/}"
    1.83 -	mv -f $TEMP_DIR/${L_TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/*.rpm $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/
    1.84 -fi
    1.85 -status
    1.86 -
    1.87 -# Extracted pkg can be removed: Save RAM
    1.88 -rm -rf $SOURCE_DIR
    1.89 -
    1.90 -# Extract everything from RPMS
    1.91 -cd $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS
    1.92 -for i in *.rpm
    1.93 -do
    1.94 -	if (! echo $i | egrep -qi $EXCLUDE); then
    1.95 -		echo -n "."
    1.96 -		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    1.97 -	fi
    1.98 -done
    1.99 -rpm2cpio libobasis*-gnome-integration*.rpm | cpio -id >> $LOG 2>&1
   1.100 -
   1.101 -# extracted pkg can be removed: Save RAM
   1.102 -rm -f libobasis*.rpm
   1.103 -
   1.104 -status
   1.105 -echo -n "Preparing package... "
   1.106 -
   1.107 -# Make the package
   1.108 -mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/usr/share
   1.109 -
   1.110 -# use mv instead of 'cp -a' to save RAM
   1.111 -mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib/libreoffice
   1.112 -mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
   1.113 -mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   1.114 -mv usr/bin $PACKAGE-$VERSION/fs/usr
   1.115 -
   1.116 -# relocalized libexec directory
   1.117 -bin=$(echo $PACKAGE-$VERSION/fs/usr/bin/libreoffice${VERSION%.*})
   1.118 -if [ -L $bin ]; then
   1.119 -	target=$(readlink $bin)
   1.120 -	rm -f $bin
   1.121 -	ln -s ${target/opt/usr\/lib\/libreoffice} $bin
   1.122 -else
   1.123 -	sed -i 's#/opt/#/usr/lib/libreoffice/#'  $bin
   1.124 -fi
   1.125 -
   1.126 -# Create receipt
   1.127 -cat > $PACKAGE-$VERSION/receipt <<EOT
   1.128 -# SliTaz package receipt.
   1.129 -
   1.130 -PACKAGE="$PACKAGE"
   1.131 -VERSION="$VERSION"
   1.132 -CATEGORY="$CATEGORY"
   1.133 -SHORT_DESC="$SHORT_DESC"
   1.134 -WEB_SITE="$WEB_SITE"
   1.135 -
   1.136 -DEPENDS="$DEPENDS"
   1.137 -SUGGESTED="$SUGGESTED"
   1.138 -
   1.139 -post_install()
   1.140 -{
   1.141 -	cd \$1/usr/share/applications
   1.142 -	ln -s /usr/lib/libreoffice*/share/xdg/base.desktop          libreoffice-base.desktop
   1.143 -	ln -s /usr/lib/libreoffice*/share/xdg/impress.desktop       libreoffice-impress.desktop
   1.144 -	ln -s /usr/lib/libreoffice*/share/xdg/writer.desktop        libreoffice-writer.desktop
   1.145 -	ln -s /usr/lib/libreoffice*/share/xdg/calc.desktop          libreoffice-calc.desktop
   1.146 -	ln -s /usr/lib/libreoffice*/share/xdg/math.desktop          libreoffice-math.desktop
   1.147 -	ln -s /usr/lib/libreoffice*/share/xdg/draw.desktop          libreoffice-draw.desktop
   1.148 -	ln -s /usr/lib/libreoffice*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
   1.149 -	chmod +x /usr/lib/libreoffice*/share/xdg/*.desktop
   1.150 -
   1.151 -	cd \$1/usr/bin
   1.152 -	ln -sf /usr/lib/libreoffice/program/soffice
   1.153 -	ln -sf /usr/lib/libreoffice/program/soffice libreoffice${VERSION%.*}
   1.154 -}
   1.155 -
   1.156 -post_remove()
   1.157 -{
   1.158 -	rm -f \$1/usr/share/applications/libreoffice-*
   1.159 -}
   1.160 -
   1.161 -EOT
   1.162 -status
   1.163 -set +e
     2.1 --- a/OpenOffice3	Sun Feb 16 20:08:16 2014 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,165 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -# get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite.
     2.6 -#
     2.7 -# (C) 2008 SliTaz - GNU General Public License v3.
     2.8 -#
     2.9 -# Author : Eric Joseph-Alexandre <erjo@slitaz.org>
    2.10 -
    2.11 -PACKAGE="OpenOffice3"
    2.12 -URL="http://www.openoffice.org"
    2.13 -PATTERN="Linux_x86_install-rpm"
    2.14 -
    2.15 -for MIRROR in \
    2.16 -http://mirror.switch.ch/ftp/mirror/OpenOffice \
    2.17 -http://openoffice.cict.fr \
    2.18 -http://wwwftp.ciril.fr/pub/openoffice \
    2.19 -http://artfiles.org/openoffice.org \
    2.20 -http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \
    2.21 -http://ftp.ntua.gr/pub/OpenOffice \
    2.22 -http://ftp.iitm.ac.in/openoffice \
    2.23 -http://www.ring.gr.jp/archives/misc/openoffice \
    2.24 -http://ftp.nluug.nl/pub/office/openoffice \
    2.25 -
    2.26 -do
    2.27 -	wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue
    2.28 -	DIR="stable"
    2.29 -	LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \
    2.30 -		grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \
    2.31 -		head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
    2.32 -	[ -n "$LOC" ] && DIR="localized/$LOC"
    2.33 -	VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \
    2.34 -	href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)"
    2.35 -	[ -n "$VERSION" ] && break
    2.36 -done
    2.37 -
    2.38 -if [ -z "$VERSION" ]; then
    2.39 -	abort_package "Can't find VERSION. Abort."
    2.40 -fi
    2.41 -echo "Selecting $DIR version $VERSION ..."
    2.42 -TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
    2.43 -	2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
    2.44 -echo "Archive is $TARBALL ..."
    2.45 -WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
    2.46 -
    2.47 -TEMP_DIR="/tmp/$PACKAGE.$$"
    2.48 -CUR_DIR=$(pwd)
    2.49 -SOURCE_DIR="/tmp/src.$$"
    2.50 -EXCLUDE="kde|gnome|test"
    2.51 -LOG="/tmp/$(basename $0 .sh).log"
    2.52 -
    2.53 -# Check if we have the tarball before.
    2.54 -if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    2.55 -	echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
    2.56 -	#Check if $SOURCE_DIR exist
    2.57 -	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    2.58 -	# Get the file.
    2.59 -	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    2.60 -	status
    2.61 -fi
    2.62 -if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    2.63 -	rm -rf $SOURCE_DIR
    2.64 -	abort_package "Could not download $TARBALL. Exiting."
    2.65 -fi
    2.66 -
    2.67 -# Creates TEMP_DIR and extract tarball
    2.68 -mkdir -p $TEMP_DIR
    2.69 -echo -n "Extract files from archive..."
    2.70 -tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 ||
    2.71 - abort_package "Failed to extract $TARBALL"
    2.72 -status
    2.73 -
    2.74 -# extracted pkg can be removed: Save RAM
    2.75 -rm -rf $SOURCE_DIR
    2.76 -
    2.77 -cd $TEMP_DIR/*/RPMS
    2.78 -
    2.79 -# Extract everything from RPMS
    2.80 -for i in *.rpm
    2.81 -do
    2.82 -	if (! echo $i | egrep -qi $EXCLUDE); then
    2.83 -		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    2.84 -	fi
    2.85 -done
    2.86 -rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
    2.87 -	
    2.88 -# extracted pkg can be removed: Save RAM
    2.89 -rm -f desktop-integration/*freedesktop*.rpm
    2.90 -
    2.91 -
    2.92 -# Make the package
    2.93 -mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice  \
    2.94 -  $PACKAGE-$VERSION/fs/usr/share
    2.95 -
    2.96 -# use mv instead of 'cp -a' to save RAM
    2.97 -mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
    2.98 -mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
    2.99 -mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   2.100 -mv usr/bin $PACKAGE-$VERSION/fs/usr
   2.101 -
   2.102 -# relocalized OOo libexec directory
   2.103 -sed -i 's#/opt/#/usr/lib/openoffice/#'  $PACKAGE-$VERSION/fs/usr/bin/openoffice*
   2.104 -
   2.105 -# Create receipt
   2.106 -cat > $PACKAGE-$VERSION/receipt <<EOT
   2.107 -# SliTaz package receipt.
   2.108 -
   2.109 -PACKAGE="$PACKAGE"
   2.110 -VERSION="$VERSION"
   2.111 -CATEGORY="office"
   2.112 -SHORT_DESC="Productivity suite."
   2.113 -DEPENDS="java-jre"
   2.114 -WEB_SITE="$URL"
   2.115 -
   2.116 -post_install()
   2.117 -{
   2.118 -	cd \$1/usr/share/applications
   2.119 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop 
   2.120 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
   2.121 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
   2.122 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
   2.123 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
   2.124 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
   2.125 -	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
   2.126 -	
   2.127 -	cd \$1/usr/bin
   2.128 -	ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
   2.129 -}
   2.130 -
   2.131 -post_remove()
   2.132 -{
   2.133 -	rm -f \$1/usr/share/applications/openoffice.org3-*
   2.134 -}
   2.135 -
   2.136 -EOT
   2.137 -
   2.138 -fake_install()
   2.139 -{
   2.140 -	mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
   2.141 -	echo "00000000000000000000000000000000  $PACKAGE-$VERSION.tazpkg" >> \
   2.142 -		$ROOT/var/lib/tazpkg/installed.md5
   2.143 -	[ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   2.144 -	( cd fs ; find *) | sed 's|^|/|' > \
   2.145 -		$ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
   2.146 -	if grep -q ^CONFIG_FILES= $1/receipt ; then
   2.147 -		cd fs
   2.148 -		find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
   2.149 -			cpio -o -H newc | gzip -9 > \
   2.150 -			$ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
   2.151 -		for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
   2.152 -			[ -e $ROOT$i ] && rm -rf .$i
   2.153 -		done
   2.154 -		cd ..
   2.155 -	fi
   2.156 -	sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
   2.157 -		$1/receipt
   2.158 -	cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   2.159 -	echo "Compute md5sum..."
   2.160 -	find fs -type f | xargs md5sum | sed 's|  fs/|  /|' > \
   2.161 -		$ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
   2.162 -	echo "Move files..."
   2.163 -	( cd $1/fs ; find ) | while read file ; do 
   2.164 -		[ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
   2.165 -		mv $1/fs/$file $(dirname $ROOT/$file)
   2.166 -	done
   2.167 -}
   2.168 -set +e
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/libreoffice	Sun Feb 16 20:20:05 2014 +0000
     3.3 @@ -0,0 +1,160 @@
     3.4 +#!/bin/sh
     3.5 +# get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite.
     3.6 +#
     3.7 +# (C) 2010 SliTaz - GNU General Public License v3.
     3.8 +# Author : Ben Arnold <ben@seawolfsanctuary.com>
     3.9 +#    via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@slitaz.org>)
    3.10 +#
    3.11 +
    3.12 +PACKAGE="LibreOffice"
    3.13 +WEB_SITE="http://www.libreoffice.org"
    3.14 +CATEGORY="office"
    3.15 +SHORT_DESC="Productivity suite."
    3.16 +DEPENDS="cups"
    3.17 +SUGGESTED="java6-jre"
    3.18 +DIR="stable"
    3.19 +PREFIX="LibreOffice"
    3.20 +SUFFIX="Linux_x86_rpm.tar.gz"
    3.21 +WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR"
    3.22 +
    3.23 +VERSION="$(basename $(wget -O - $WGET_URL/ 2> /dev/null | \
    3.24 +	sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tail -1))"
    3.25 +if [ -z "$VERSION" ]; then
    3.26 +	abort_package "Can't detect an appropriate version. The version numbering or URL may have changed. Aborted."
    3.27 +fi
    3.28 +VER="${VERSION/\-/}" # without hyphens
    3.29 +
    3.30 +
    3.31 +TARBALL="${PREFIX}_${VER}_${SUFFIX}"
    3.32 +
    3.33 +for LOC in ${LANG/_/-} ${LANG%_*}; do
    3.34 +	L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
    3.35 +	L_TARBALL="${PREFIX}_${VER}_${L_SUFFIX}"
    3.36 +	LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
    3.37 +	busybox wget -s $LANG_URL 2> /dev/null || continue
    3.38 +	echo "Added $LANG ($LOC)."
    3.39 +	break
    3.40 +done
    3.41 +WGET_URL="$WGET_URL/${VERSION}/rpm/x86/${TARBALL}"
    3.42 +
    3.43 +CUR_DIR=$(pwd)
    3.44 +TEMP_DIR="/tmp/$PACKAGE.$$"
    3.45 +SOURCE_DIR="/tmp/src.$$"
    3.46 +EXCLUDE="kde|gnome|test"
    3.47 +LOG="/tmp/$(basename $0 .sh).log"
    3.48 +
    3.49 +# Check if we have the tarball before.
    3.50 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    3.51 +	echo "Downloading LibreOffice tarball (it's time to have a break)... "
    3.52 +	# Check if $SOURCE_DIR exist
    3.53 +	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    3.54 +	# Get the file.
    3.55 +	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    3.56 +	if [ -n $L_TARBALL ] ; then # Are we localised?
    3.57 +		wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
    3.58 +	fi
    3.59 +	status
    3.60 +fi
    3.61 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    3.62 +	rm -rf $SOURCE_DIR
    3.63 +	abort_package "Could not download $TARBALL. Exiting."
    3.64 +fi
    3.65 +
    3.66 +echo -n "Extracting files (this may take a while): "
    3.67 +
    3.68 +# Creates TEMP_DIR and extract tarball
    3.69 +mkdir -p $TEMP_DIR
    3.70 +for TB in $TARBALL $L_TARBALL ; do
    3.71 +	tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 ||
    3.72 +	abort_package "Failed to extract $TB"
    3.73 +done
    3.74 +
    3.75 +# Get version found in archive (often directory is still RC version when final is present)
    3.76 +ARCHIVED_VERSION=$(find $TEMP_DIR -type d 2> /dev/null | sed "/$PREFIX/!d;\$!d;s/_/ /g" | awk '{print $2}')
    3.77 +echo -n "(found v${ARCHIVED_VERSION})"
    3.78 +
    3.79 +# Consolidate localisations into main package
    3.80 +if [ -n $L_TARBALL ] ; then # Are we localised?
    3.81 +	  TARBALL_NAME="${TARBALL/.tar.gz/}"
    3.82 +	L_TARBALL_NAME="${L_TARBALL/.tar.gz/}"
    3.83 +	mv -f $TEMP_DIR/${L_TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/*.rpm $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/
    3.84 +fi
    3.85 +status
    3.86 +
    3.87 +# Extracted pkg can be removed: Save RAM
    3.88 +rm -rf $SOURCE_DIR
    3.89 +
    3.90 +# Extract everything from RPMS
    3.91 +cd $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS
    3.92 +for i in *.rpm
    3.93 +do
    3.94 +	if (! echo $i | egrep -qi $EXCLUDE); then
    3.95 +		echo -n "."
    3.96 +		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    3.97 +	fi
    3.98 +done
    3.99 +rpm2cpio libobasis*-gnome-integration*.rpm | cpio -id >> $LOG 2>&1
   3.100 +
   3.101 +# extracted pkg can be removed: Save RAM
   3.102 +rm -f libobasis*.rpm
   3.103 +
   3.104 +status
   3.105 +echo -n "Preparing package... "
   3.106 +
   3.107 +# Make the package
   3.108 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/usr/share
   3.109 +
   3.110 +# use mv instead of 'cp -a' to save RAM
   3.111 +mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib/libreoffice
   3.112 +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
   3.113 +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   3.114 +mv usr/bin $PACKAGE-$VERSION/fs/usr
   3.115 +
   3.116 +# relocalized libexec directory
   3.117 +bin=$(echo $PACKAGE-$VERSION/fs/usr/bin/libreoffice${VERSION%.*})
   3.118 +if [ -L $bin ]; then
   3.119 +	target=$(readlink $bin)
   3.120 +	rm -f $bin
   3.121 +	ln -s ${target/opt/usr\/lib\/libreoffice} $bin
   3.122 +else
   3.123 +	sed -i 's#/opt/#/usr/lib/libreoffice/#'  $bin
   3.124 +fi
   3.125 +
   3.126 +# Create receipt
   3.127 +cat > $PACKAGE-$VERSION/receipt <<EOT
   3.128 +# SliTaz package receipt.
   3.129 +
   3.130 +PACKAGE="$PACKAGE"
   3.131 +VERSION="$VERSION"
   3.132 +CATEGORY="$CATEGORY"
   3.133 +SHORT_DESC="$SHORT_DESC"
   3.134 +WEB_SITE="$WEB_SITE"
   3.135 +
   3.136 +DEPENDS="$DEPENDS"
   3.137 +SUGGESTED="$SUGGESTED"
   3.138 +
   3.139 +post_install()
   3.140 +{
   3.141 +	cd \$1/usr/share/applications
   3.142 +	ln -s /usr/lib/libreoffice*/share/xdg/base.desktop          libreoffice-base.desktop
   3.143 +	ln -s /usr/lib/libreoffice*/share/xdg/impress.desktop       libreoffice-impress.desktop
   3.144 +	ln -s /usr/lib/libreoffice*/share/xdg/writer.desktop        libreoffice-writer.desktop
   3.145 +	ln -s /usr/lib/libreoffice*/share/xdg/calc.desktop          libreoffice-calc.desktop
   3.146 +	ln -s /usr/lib/libreoffice*/share/xdg/math.desktop          libreoffice-math.desktop
   3.147 +	ln -s /usr/lib/libreoffice*/share/xdg/draw.desktop          libreoffice-draw.desktop
   3.148 +	ln -s /usr/lib/libreoffice*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
   3.149 +	chmod +x /usr/lib/libreoffice*/share/xdg/*.desktop
   3.150 +
   3.151 +	cd \$1/usr/bin
   3.152 +	ln -sf /usr/lib/libreoffice/program/soffice
   3.153 +	ln -sf /usr/lib/libreoffice/program/soffice libreoffice${VERSION%.*}
   3.154 +}
   3.155 +
   3.156 +post_remove()
   3.157 +{
   3.158 +	rm -f \$1/usr/share/applications/libreoffice-*
   3.159 +}
   3.160 +
   3.161 +EOT
   3.162 +status
   3.163 +set +e
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/openoffice3	Sun Feb 16 20:20:05 2014 +0000
     4.3 @@ -0,0 +1,165 @@
     4.4 +#!/bin/sh
     4.5 +# get-OpenOffice3, install everything for OpenOffice.org exept KDE/Gnome integration and testsuite.
     4.6 +#
     4.7 +# (C) 2008 SliTaz - GNU General Public License v3.
     4.8 +#
     4.9 +# Author : Eric Joseph-Alexandre <erjo@slitaz.org>
    4.10 +
    4.11 +PACKAGE="OpenOffice3"
    4.12 +URL="http://www.openoffice.org"
    4.13 +PATTERN="Linux_x86_install-rpm"
    4.14 +
    4.15 +for MIRROR in \
    4.16 +http://mirror.switch.ch/ftp/mirror/OpenOffice \
    4.17 +http://openoffice.cict.fr \
    4.18 +http://wwwftp.ciril.fr/pub/openoffice \
    4.19 +http://artfiles.org/openoffice.org \
    4.20 +http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \
    4.21 +http://ftp.ntua.gr/pub/OpenOffice \
    4.22 +http://ftp.iitm.ac.in/openoffice \
    4.23 +http://www.ring.gr.jp/archives/misc/openoffice \
    4.24 +http://ftp.nluug.nl/pub/office/openoffice \
    4.25 +
    4.26 +do
    4.27 +	wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue
    4.28 +	DIR="stable"
    4.29 +	LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \
    4.30 +		grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \
    4.31 +		head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/')
    4.32 +	[ -n "$LOC" ] && DIR="localized/$LOC"
    4.33 +	VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \
    4.34 +	href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)"
    4.35 +	[ -n "$VERSION" ] && break
    4.36 +done
    4.37 +
    4.38 +if [ -z "$VERSION" ]; then
    4.39 +	abort_package "Can't find VERSION. Abort."
    4.40 +fi
    4.41 +echo "Selecting $DIR version $VERSION ..."
    4.42 +TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \
    4.43 +	2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')"
    4.44 +echo "Archive is $TARBALL ..."
    4.45 +WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL
    4.46 +
    4.47 +TEMP_DIR="/tmp/$PACKAGE.$$"
    4.48 +CUR_DIR=$(pwd)
    4.49 +SOURCE_DIR="/tmp/src.$$"
    4.50 +EXCLUDE="kde|gnome|test"
    4.51 +LOG="/tmp/$(basename $0 .sh).log"
    4.52 +
    4.53 +# Check if we have the tarball before.
    4.54 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    4.55 +	echo "Downloading OppenOffice.org tarball (it's time to have a break)... "
    4.56 +	#Check if $SOURCE_DIR exist
    4.57 +	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    4.58 +	# Get the file.
    4.59 +	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    4.60 +	status
    4.61 +fi
    4.62 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    4.63 +	rm -rf $SOURCE_DIR
    4.64 +	abort_package "Could not download $TARBALL. Exiting."
    4.65 +fi
    4.66 +
    4.67 +# Creates TEMP_DIR and extract tarball
    4.68 +mkdir -p $TEMP_DIR
    4.69 +echo -n "Extract files from archive..."
    4.70 +tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 ||
    4.71 + abort_package "Failed to extract $TARBALL"
    4.72 +status
    4.73 +
    4.74 +# extracted pkg can be removed: Save RAM
    4.75 +rm -rf $SOURCE_DIR
    4.76 +
    4.77 +cd $TEMP_DIR/*/RPMS
    4.78 +
    4.79 +# Extract everything from RPMS
    4.80 +for i in *.rpm
    4.81 +do
    4.82 +	if (! echo $i | egrep -qi $EXCLUDE); then
    4.83 +		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    4.84 +	fi
    4.85 +done
    4.86 +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
    4.87 +	
    4.88 +# extracted pkg can be removed: Save RAM
    4.89 +rm -f desktop-integration/*freedesktop*.rpm
    4.90 +
    4.91 +
    4.92 +# Make the package
    4.93 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/openoffice  \
    4.94 +  $PACKAGE-$VERSION/fs/usr/share
    4.95 +
    4.96 +# use mv instead of 'cp -a' to save RAM
    4.97 +mv opt/openoffice* $PACKAGE-$VERSION/fs/usr/lib/openoffice
    4.98 +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
    4.99 +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   4.100 +mv usr/bin $PACKAGE-$VERSION/fs/usr
   4.101 +
   4.102 +# relocalized OOo libexec directory
   4.103 +sed -i 's#/opt/#/usr/lib/openoffice/#'  $PACKAGE-$VERSION/fs/usr/bin/openoffice*
   4.104 +
   4.105 +# Create receipt
   4.106 +cat > $PACKAGE-$VERSION/receipt <<EOT
   4.107 +# SliTaz package receipt.
   4.108 +
   4.109 +PACKAGE="$PACKAGE"
   4.110 +VERSION="$VERSION"
   4.111 +CATEGORY="office"
   4.112 +SHORT_DESC="Productivity suite."
   4.113 +DEPENDS="java-jre"
   4.114 +WEB_SITE="$URL"
   4.115 +
   4.116 +post_install()
   4.117 +{
   4.118 +	cd \$1/usr/share/applications
   4.119 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/base.desktop openoffice.org3-base.desktop 
   4.120 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/impress.desktop openoffice.org3-impress.desktop
   4.121 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/writer.desktop openoffice.org3-writer.desktop
   4.122 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/calc.desktop openoffice.org3-calc.desktop
   4.123 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/math.desktop openoffice.org3-math.desktop
   4.124 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/draw.desktop openoffice.org3-draw.desktop
   4.125 +	ln -s /usr/lib/openoffice/openoffice.org3/share/xdg/printeradmin.desktop openoffice.org3-printeradmin.desktop
   4.126 +	
   4.127 +	cd \$1/usr/bin
   4.128 +	ln -sf /usr/lib/openoffice/openoffice.org3/program/soffice
   4.129 +}
   4.130 +
   4.131 +post_remove()
   4.132 +{
   4.133 +	rm -f \$1/usr/share/applications/openoffice.org3-*
   4.134 +}
   4.135 +
   4.136 +EOT
   4.137 +
   4.138 +fake_install()
   4.139 +{
   4.140 +	mkdir -p $ROOT/var/lib/tazpkg/installed/$PACKAGE
   4.141 +	echo "00000000000000000000000000000000  $PACKAGE-$VERSION.tazpkg" >> \
   4.142 +		$ROOT/var/lib/tazpkg/installed.md5
   4.143 +	[ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   4.144 +	( cd fs ; find *) | sed 's|^|/|' > \
   4.145 +		$ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list
   4.146 +	if grep -q ^CONFIG_FILES= $1/receipt ; then
   4.147 +		cd fs
   4.148 +		find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\
   4.149 +			cpio -o -H newc | gzip -9 > \
   4.150 +			$ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz
   4.151 +		for i in $( . ./receipt ; echo $CONFIG_FILES) ; do
   4.152 +			[ -e $ROOT$i ] && rm -rf .$i
   4.153 +		done
   4.154 +		cd ..
   4.155 +	fi
   4.156 +	sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \
   4.157 +		$1/receipt
   4.158 +	cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE
   4.159 +	echo "Compute md5sum..."
   4.160 +	find fs -type f | xargs md5sum | sed 's|  fs/|  /|' > \
   4.161 +		$ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum
   4.162 +	echo "Move files..."
   4.163 +	( cd $1/fs ; find ) | while read file ; do 
   4.164 +		[ -e $1/fs/$file -a ! -e $ROOT/$file ] &&
   4.165 +		mv $1/fs/$file $(dirname $ROOT/$file)
   4.166 +	done
   4.167 +}
   4.168 +set +e