# HG changeset patch # User Ben Arnold # Date 1293400838 0 # Node ID 4532856df3bad5ee2fcd63f9d178698b5c7c3e26 # Parent adf1e2623e66a68401f176d5fd1dc59f153ee911 Add get-LibreOffice (v1.0) - script (based on get-OpenOffice3) to download and package LibreOffice w/out lang. packs diff -r adf1e2623e66 -r 4532856df3ba get-LibreOffice/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get-LibreOffice/receipt Sun Dec 26 22:00:38 2010 +0000 @@ -0,0 +1,16 @@ +# SliTaz package receipt. + +PACKAGE="get-LibreOffice" +VERSION="1.0" +CATEGORY="office" +SHORT_DESC="Productivity suite." +MAINTAINER="ben@seawolfsanctuary.com" +WEB_SITE="http://www.documentfoundation.org" +TAGS="office word excel ppt openoffice libreoffice" + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + mkdir -p $fs/usr/bin + install -o root -g root -m755 stuff/get-LibreOffice $fs/usr/bin +} \ No newline at end of file diff -r adf1e2623e66 -r 4532856df3ba get-LibreOffice/stuff/get-LibreOffice --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get-LibreOffice/stuff/get-LibreOffice Sun Dec 26 22:00:38 2010 +0000 @@ -0,0 +1,186 @@ +#!/bin/sh +# get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite. +# +# (C) 2010 SliTaz - GNU General Public License v3. +# Author : Ben Arnold +# via : get-OpenOffice3 (Eric Joseph-Alexandre ) +# + +PACKAGE="LibreOffice" +URL="http://www.libreoffice.org" +ROOT="$1" + +DIR="testing" +SUFFIX="Linux_x86_install-rpm_en-US.tar.gz" + +VERSION="$(basename $(wget -O - http://download.documentfoundation.org/libreoffice/$DIR/ \ + 2> /dev/null | grep href=\"[0-9] | tail -1 | sed 's/.*href=\"//;s/[/\">].*//'))" +if [ -z "$VERSION" ]; then + echo "Can't detect an appropriate version. The version numbering or URL may have changed. + Aborted." + exit 0 +fi +VER="${VERSION/\-/}" # without hyphens + +TARBALL="LibO_${VER}_${SUFFIX}" +WGET_URL="http://download.documentfoundation.org/libreoffice/${DIR}/${VERSION}/rpm/x86/${TARBALL}" +TEMP_DIR="/tmp/$PACKAGE.$$" +SOURCE_DIR="/tmp/src.$$" +EXCLUDE="kde|gnome|test" +LOG="/tmp/$(basename $0 .sh).log" + +# Status function with color (supported by Ash). +status() +{ + local CHECK=$? + echo -en "\\033[70G[ " + if [ $CHECK = 0 ]; then + echo -en "\\033[1;33mOK" + else + echo -en "\\033[1;31mFailed" + fi + echo -e "\\033[0;39m ]" + return $CHECK +} + +# Check if user is root to install, or remove packages. +check_root() +{ + if test $(id -u) != 0 ; then + echo -e "\nYou must be root to run `basename $0` with this option." + echo -e "Please use 'su' and root password to become super-user.\n" + exit 0 + fi +} + +check_if_installed() +{ + # Avoid reinstall + if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ];then + return 0 + else + return 1 + fi +} + +#We need to bee root +check_root + +#check if package already installed +if (check_if_installed $PACKAGE); then + echo "$PACKAGE is already installed." + [ -n "$ROOT" ] && exit 0 + echo -n "Would you like to remove and reinstall this package [y/n]? " + read answer + case "$answer" in + y|Y) + tazpkg remove $PACKAGE ;; + *) + exit 0 ;; + esac + +fi + + +# Check if we have the tarball before. +if [ ! -f $SOURCE_DIR/$TARBALL ]; then + echo "Downloading LibreOffice tarball (it's time to have a break)... " + #Check if $SOURCE_DIR exist + test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR + # Get the file. + wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL + status +fi +if [ ! -f $SOURCE_DIR/$TARBALL ]; then + rm -rf $SOURCE_DIR + echo "Could not download $TARBALL. Exiting." + exit 1 +fi + +# Creates TEMP_DIR and extract tarball +mkdir -p $TEMP_DIR +echo -n "Extract files from archive..." +tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \ + (echo "Failed to extract $TARBALL" ; exit 1) +status + +# extracted pkg can be removed: Save RAM +rm -rf $SOURCE_DIR + +cd $TEMP_DIR/*/RPMS + +# Extract everything from RPMS +echo -n "Extracting files" +for i in *.rpm +do + if (! echo $i | egrep -qi $EXCLUDE); then + echo -n "." + (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i + fi +done +rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1 + +# extracted pkg can be removed: Save RAM +rm -f desktop-integration/*freedesktop*.rpm + +status +echo -n "Preparing package... " + +# Make the package +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/libreoffice \ + $PACKAGE-$VERSION/fs/usr/share + +# use mv instead of 'cp -a' to save RAM +mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib +mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share +mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share +mv usr/bin $PACKAGE-$VERSION/fs/usr + +# relocalized OOo libexec directory +sed -i 's#/opt/#/usr/lib/libreoffice/#' $PACKAGE-$VERSION/fs/usr/bin/libreoffice* + +# Create receipt +cat > $PACKAGE-$VERSION/receipt <