wok-next rev 7833

Fix: get-LibreOffice - because v1.0 never works, right?
author Ben Arnold <ben@seawolfsanctuary.com>
date Mon Dec 27 00:48:31 2010 +0000 (2010-12-27)
parents 4532856df3ba
children a6abbedd28e6
files get-LibreOffice/receipt get-LibreOffice/stuff/get-LibreOffice
line diff
     1.1 --- a/get-LibreOffice/receipt	Sun Dec 26 22:00:38 2010 +0000
     1.2 +++ b/get-LibreOffice/receipt	Mon Dec 27 00:48:31 2010 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="get-LibreOffice"
     1.7 -VERSION="1.0"
     1.8 +VERSION="1.1"
     1.9  CATEGORY="office"
    1.10  SHORT_DESC="Productivity suite."
    1.11  MAINTAINER="ben@seawolfsanctuary.com"
     2.1 --- a/get-LibreOffice/stuff/get-LibreOffice	Sun Dec 26 22:00:38 2010 +0000
     2.2 +++ b/get-LibreOffice/stuff/get-LibreOffice	Mon Dec 27 00:48:31 2010 +0000
     2.3 @@ -9,26 +9,44 @@
     2.4  PACKAGE="LibreOffice"
     2.5  URL="http://www.libreoffice.org"
     2.6  ROOT="$1"
     2.7 -
     2.8  DIR="testing"
     2.9  SUFFIX="Linux_x86_install-rpm_en-US.tar.gz"
    2.10  
    2.11  VERSION="$(basename $(wget -O - http://download.documentfoundation.org/libreoffice/$DIR/ \
    2.12  	2> /dev/null | grep href=\"[0-9] | tail -1 | sed 's/.*href=\"//;s/[/\">].*//'))"
    2.13 -if [ -z "$VERSION" ]; then
    2.14 -	echo "Can't detect an appropriate version. The version numbering or URL may have changed.
    2.15 -  Aborted."
    2.16 -	exit 0
    2.17 -fi
    2.18 -VER="${VERSION/\-/}" # without hyphens
    2.19 +  if [ -z "$VERSION" ]; then
    2.20 +    echo "Can't detect an appropriate version. The version numbering or URL may have changed.
    2.21 +    Aborted."
    2.22 +    exit 0
    2.23 +  fi
    2.24 +  VER="${VERSION/\-/}" # without hyphens
    2.25 +
    2.26  
    2.27  TARBALL="LibO_${VER}_${SUFFIX}"
    2.28  WGET_URL="http://download.documentfoundation.org/libreoffice/${DIR}/${VERSION}/rpm/x86/${TARBALL}"
    2.29 +
    2.30 +case "$LANG" in
    2.31 +fr_FR|de_DE|es_ES|it_IT|ru_RU)
    2.32 +	LOC=${LANG%_*} # strip
    2.33 +	L_SUFFIX="Linux_x86_langpack-rpm_$LOC.tar.gz"
    2.34 +  L_TARBALL="LibO_${VER}_${L_SUFFIX}"
    2.35 +  LANG_URL="http://download.documentfoundation.org/libreoffice/${DIR}/${VERSION}/rpm/x86/${L_TARBALL}"
    2.36 +  echo "Added $LANG ($LOC)." ;;
    2.37 +en_GB|pt_BR)
    2.38 +  LANG=${LANG/_/-} # convert
    2.39 +	L_SUFFIX="Linux_x86_langpack-rpm_$LANG.tar.gz"
    2.40 +  L_TARBALL="LibO_${VER}_${L_SUFFIX}"
    2.41 +  LANG_URL="http://download.documentfoundation.org/libreoffice/${DIR}/${VERSION}/rpm/x86/${L_TARBALL}"
    2.42 +  echo "Added $LANG." ;;
    2.43 +esac
    2.44 +
    2.45 +
    2.46  TEMP_DIR="/tmp/$PACKAGE.$$"
    2.47  SOURCE_DIR="/tmp/src.$$"
    2.48  EXCLUDE="kde|gnome|test"
    2.49  LOG="/tmp/$(basename $0 .sh).log"
    2.50  
    2.51 +
    2.52  # Status function with color (supported by Ash).
    2.53  status()
    2.54  {
    2.55 @@ -63,10 +81,10 @@
    2.56  	 fi
    2.57  }
    2.58  
    2.59 -#We need to bee root
    2.60 +# We need to be root
    2.61  check_root
    2.62  
    2.63 -#check if package already installed
    2.64 +# Check if package already installed
    2.65  if (check_if_installed $PACKAGE); then
    2.66  	echo "$PACKAGE is already installed."
    2.67  	[ -n "$ROOT" ] && exit 0
    2.68 @@ -89,6 +107,9 @@
    2.69  	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    2.70  	# Get the file.
    2.71  	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    2.72 +	if [ -n $L_TARBALL ] ; then # Are we localised?
    2.73 +    wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
    2.74 +  fi
    2.75  	status
    2.76  fi
    2.77  if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    2.78 @@ -97,20 +118,26 @@
    2.79  	exit 1
    2.80  fi
    2.81  
    2.82 +echo -n "Extracting files "
    2.83 +
    2.84  # Creates TEMP_DIR and extract tarball
    2.85  mkdir -p $TEMP_DIR
    2.86 -echo -n "Extract files from archive..."
    2.87 -tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
    2.88 - (echo "Failed to extract $TARBALL" ; exit 1)
    2.89 +for TB in $TARBALL $L_TARBALL ; do
    2.90 +  tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 || \
    2.91 +  (echo "Failed to extract $TB" ; exit 1)
    2.92 +done
    2.93 +# Consolidate localisations into main package
    2.94 +if [ -n $L_TARBALL ] ; then # Are we localised?
    2.95 +  mv -f $TEMP_DIR/${L_TARBALL/.tar.gz/}/RPMS/*.rpm $TEMP_DIR/${TARBALL/.tar.gz/}/RPMS/
    2.96 +fi
    2.97  status
    2.98  
    2.99 -# extracted pkg can be removed: Save RAM
   2.100 +# Extracted pkg can be removed: Save RAM
   2.101  rm -rf $SOURCE_DIR
   2.102  
   2.103 -cd $TEMP_DIR/*/RPMS
   2.104 +cd $TEMP_DIR/${TARBALL/.tar.gz/}/RPMS
   2.105  
   2.106  # Extract everything from RPMS
   2.107 -echo -n "Extracting files"
   2.108  for i in *.rpm
   2.109  do
   2.110  	if (! echo $i | egrep -qi $EXCLUDE); then
   2.111 @@ -136,7 +163,7 @@
   2.112  mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
   2.113  mv usr/bin $PACKAGE-$VERSION/fs/usr
   2.114  
   2.115 -# relocalized OOo libexec directory
   2.116 +# relocalized libexec directory
   2.117  sed -i 's#/opt/#/usr/lib/libreoffice/#'  $PACKAGE-$VERSION/fs/usr/bin/libreoffice*
   2.118  
   2.119  # Create receipt
   2.120 @@ -161,7 +188,9 @@
   2.121  	ln -s /usr/lib/libreoffice/share/xdg/draw.desktop libreoffice-draw.desktop
   2.122  	ln -s /usr/lib/libreoffice/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
   2.123  
   2.124 +
   2.125  	cd /usr/bin
   2.126 +  ln -s /usr/lib/libreoffice /usr/lib/libreoffice/libreoffice
   2.127  	ln -sf /usr/lib/libreoffice/program/soffice
   2.128  }
   2.129