get-scripts annotate LibreOffice @ rev 3

Add some wifi-firmaware
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 16 20:08:16 2014 +0000 (2014-02-16)
parents 1b9497240a07
children
rev   line source
pascal@1 1 #!/bin/sh
pascal@1 2 # get-LibreOffice - install LibreOffice excl. KDE/Gnome integration & test suite.
pascal@1 3 #
pascal@1 4 # (C) 2010 SliTaz - GNU General Public License v3.
pascal@1 5 # Author : Ben Arnold <ben@seawolfsanctuary.com>
pascal@1 6 # via : get-OpenOffice3 (Eric Joseph-Alexandre <erjo@slitaz.org>)
pascal@1 7 #
pascal@1 8
pascal@1 9 PACKAGE="LibreOffice"
pascal@1 10 WEB_SITE="http://www.libreoffice.org"
pascal@1 11 CATEGORY="office"
pascal@1 12 SHORT_DESC="Productivity suite."
pascal@1 13 DEPENDS="cups"
pascal@1 14 SUGGESTED="java6-jre"
pascal@1 15 DIR="stable"
pascal@1 16 PREFIX="LibreOffice"
pascal@1 17 SUFFIX="Linux_x86_rpm.tar.gz"
pascal@1 18 WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR"
pascal@1 19
pascal@1 20 VERSION="$(basename $(wget -O - $WGET_URL/ 2> /dev/null | \
pascal@1 21 sed '/href=\"[0-9]/!d;s/.*href=\"//;s/[/\">].*//' | tail -1))"
pascal@1 22 if [ -z "$VERSION" ]; then
pascal@1 23 abort_package "Can't detect an appropriate version. The version numbering or URL may have changed. Aborted."
pascal@1 24 fi
pascal@1 25 VER="${VERSION/\-/}" # without hyphens
pascal@1 26
pascal@1 27
pascal@1 28 TARBALL="${PREFIX}_${VER}_${SUFFIX}"
pascal@1 29
pascal@1 30 for LOC in ${LANG/_/-} ${LANG%_*}; do
pascal@1 31 L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
pascal@1 32 L_TARBALL="${PREFIX}_${VER}_${L_SUFFIX}"
pascal@1 33 LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
pascal@1 34 busybox wget -s $LANG_URL 2> /dev/null || continue
pascal@1 35 echo "Added $LANG ($LOC)."
pascal@1 36 break
pascal@1 37 done
pascal@1 38 WGET_URL="$WGET_URL/${VERSION}/rpm/x86/${TARBALL}"
pascal@1 39
pascal@1 40 CUR_DIR=$(pwd)
pascal@1 41 TEMP_DIR="/tmp/$PACKAGE.$$"
pascal@1 42 SOURCE_DIR="/tmp/src.$$"
pascal@1 43 EXCLUDE="kde|gnome|test"
pascal@1 44 LOG="/tmp/$(basename $0 .sh).log"
pascal@1 45
pascal@1 46 # Check if we have the tarball before.
pascal@1 47 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
pascal@1 48 echo "Downloading LibreOffice tarball (it's time to have a break)... "
pascal@1 49 # Check if $SOURCE_DIR exist
pascal@1 50 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
pascal@1 51 # Get the file.
pascal@1 52 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
pascal@1 53 if [ -n $L_TARBALL ] ; then # Are we localised?
pascal@1 54 wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
pascal@1 55 fi
pascal@1 56 status
pascal@1 57 fi
pascal@1 58 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
pascal@1 59 rm -rf $SOURCE_DIR
pascal@1 60 abort_package "Could not download $TARBALL. Exiting."
pascal@1 61 fi
pascal@1 62
pascal@1 63 echo -n "Extracting files (this may take a while): "
pascal@1 64
pascal@1 65 # Creates TEMP_DIR and extract tarball
pascal@1 66 mkdir -p $TEMP_DIR
pascal@1 67 for TB in $TARBALL $L_TARBALL ; do
pascal@1 68 tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 ||
pascal@1 69 abort_package "Failed to extract $TB"
pascal@1 70 done
pascal@1 71
pascal@1 72 # Get version found in archive (often directory is still RC version when final is present)
pascal@1 73 ARCHIVED_VERSION=$(find $TEMP_DIR -type d 2> /dev/null | sed "/$PREFIX/!d;\$!d;s/_/ /g" | awk '{print $2}')
pascal@1 74 echo -n "(found v${ARCHIVED_VERSION})"
pascal@1 75
pascal@1 76 # Consolidate localisations into main package
pascal@1 77 if [ -n $L_TARBALL ] ; then # Are we localised?
pascal@1 78 TARBALL_NAME="${TARBALL/.tar.gz/}"
pascal@1 79 L_TARBALL_NAME="${L_TARBALL/.tar.gz/}"
pascal@1 80 mv -f $TEMP_DIR/${L_TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/*.rpm $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS/
pascal@1 81 fi
pascal@1 82 status
pascal@1 83
pascal@1 84 # Extracted pkg can be removed: Save RAM
pascal@1 85 rm -rf $SOURCE_DIR
pascal@1 86
pascal@1 87 # Extract everything from RPMS
pascal@1 88 cd $TEMP_DIR/${TARBALL_NAME/$VERSION/$ARCHIVED_VERSION}/RPMS
pascal@1 89 for i in *.rpm
pascal@1 90 do
pascal@1 91 if (! echo $i | egrep -qi $EXCLUDE); then
pascal@1 92 echo -n "."
pascal@1 93 (rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm -f $i
pascal@1 94 fi
pascal@1 95 done
pascal@1 96 rpm2cpio libobasis*-gnome-integration*.rpm | cpio -id >> $LOG 2>&1
pascal@1 97
pascal@1 98 # extracted pkg can be removed: Save RAM
pascal@1 99 rm -f libobasis*.rpm
pascal@1 100
pascal@1 101 status
pascal@1 102 echo -n "Preparing package... "
pascal@1 103
pascal@1 104 # Make the package
pascal@1 105 mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/usr/share
pascal@1 106
pascal@1 107 # use mv instead of 'cp -a' to save RAM
pascal@1 108 mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib/libreoffice
pascal@1 109 mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
pascal@1 110 mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
pascal@1 111 mv usr/bin $PACKAGE-$VERSION/fs/usr
pascal@1 112
pascal@1 113 # relocalized libexec directory
pascal@1 114 bin=$(echo $PACKAGE-$VERSION/fs/usr/bin/libreoffice${VERSION%.*})
pascal@1 115 if [ -L $bin ]; then
pascal@1 116 target=$(readlink $bin)
pascal@1 117 rm -f $bin
pascal@1 118 ln -s ${target/opt/usr\/lib\/libreoffice} $bin
pascal@1 119 else
pascal@1 120 sed -i 's#/opt/#/usr/lib/libreoffice/#' $bin
pascal@1 121 fi
pascal@1 122
pascal@1 123 # Create receipt
pascal@1 124 cat > $PACKAGE-$VERSION/receipt <<EOT
pascal@1 125 # SliTaz package receipt.
pascal@1 126
pascal@1 127 PACKAGE="$PACKAGE"
pascal@1 128 VERSION="$VERSION"
pascal@1 129 CATEGORY="$CATEGORY"
pascal@1 130 SHORT_DESC="$SHORT_DESC"
pascal@1 131 WEB_SITE="$WEB_SITE"
pascal@1 132
pascal@1 133 DEPENDS="$DEPENDS"
pascal@1 134 SUGGESTED="$SUGGESTED"
pascal@1 135
pascal@1 136 post_install()
pascal@1 137 {
pascal@1 138 cd \$1/usr/share/applications
pascal@1 139 ln -s /usr/lib/libreoffice*/share/xdg/base.desktop libreoffice-base.desktop
pascal@1 140 ln -s /usr/lib/libreoffice*/share/xdg/impress.desktop libreoffice-impress.desktop
pascal@1 141 ln -s /usr/lib/libreoffice*/share/xdg/writer.desktop libreoffice-writer.desktop
pascal@1 142 ln -s /usr/lib/libreoffice*/share/xdg/calc.desktop libreoffice-calc.desktop
pascal@1 143 ln -s /usr/lib/libreoffice*/share/xdg/math.desktop libreoffice-math.desktop
pascal@1 144 ln -s /usr/lib/libreoffice*/share/xdg/draw.desktop libreoffice-draw.desktop
pascal@1 145 ln -s /usr/lib/libreoffice*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
pascal@1 146 chmod +x /usr/lib/libreoffice*/share/xdg/*.desktop
pascal@1 147
pascal@1 148 cd \$1/usr/bin
pascal@1 149 ln -sf /usr/lib/libreoffice/program/soffice
pascal@1 150 ln -sf /usr/lib/libreoffice/program/soffice libreoffice${VERSION%.*}
pascal@1 151 }
pascal@1 152
pascal@1 153 post_remove()
pascal@1 154 {
pascal@1 155 rm -f \$1/usr/share/applications/libreoffice-*
pascal@1 156 }
pascal@1 157
pascal@1 158 EOT
pascal@1 159 status
pascal@2 160 set +e