get-scripts rev 1

Add LibreOffice OpenOffice3
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 16 13:47:07 2014 +0000 (2014-02-16)
parents 82a491ecdeb5
children 38581c20c3f1
files LibreOffice OpenOffice3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/LibreOffice	Sun Feb 16 13:47:07 2014 +0000
     1.3 @@ -0,0 +1,159 @@
     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
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/OpenOffice3	Sun Feb 16 13:47:07 2014 +0000
     2.3 @@ -0,0 +1,164 @@
     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 +}