SHORT_DESC="Productivity suite." WEB_SITE="http://www.openoffice.org" CATEGORY="office" LICENSE="Apache" # end of get.list data PACKAGE="OpenOffice3" PATTERN="Linux_x86_install-rpm" for MIRROR in \ http://mirror.switch.ch/ftp/mirror/OpenOffice \ http://openoffice.cict.fr \ http://wwwftp.ciril.fr/pub/openoffice \ http://artfiles.org/openoffice.org \ http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/OpenOffice \ http://ftp.ntua.gr/pub/OpenOffice \ http://ftp.iitm.ac.in/openoffice \ http://www.ring.gr.jp/archives/misc/openoffice \ http://ftp.nluug.nl/pub/office/openoffice \ do wget -O - $MIRROR/ 2> /dev/null | grep -q localized || continue DIR="stable" LOC=$(wget -O - $MIRROR/localized/ 2> /dev/null | \ grep -E ">$LANG/|>${LANG/_/-}/|>${LANG%_*}/" | \ head -1 | sed 's/.*href=\"\(.*\)\/\".*/\1/') [ -n "$LOC" ] && DIR="localized/$LOC" VERSION="$(basename $(wget -O - $MIRROR/$DIR/ 2> /dev/null | grep \ href=\"[0-9] | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/') 2> /dev/null)" [ -n "$VERSION" ] || continue [ "$1" = "--get-version" ] && echo $VERSION && exit break done [ "$VERSION" ] || abort_package "Can't find VERSION. Abort." echo "Selecting $DIR version $VERSION ..." TARBALL="$(wget -O - $MIRROR/$DIR/$VERSION/ \ 2> /dev/null | grep $PATTERN | tail -1 | sed 's/.*href=\"\(.*\)\".*/\1/')" echo "Archive is $TARBALL ..." WGET_URL=$MIRROR/$DIR/$VERSION/$TARBALL TEMP_DIR="/tmp/$PACKAGE.$$" CUR_DIR=$(pwd) SOURCE_DIR="/tmp/src.$$" EXCLUDE="kde|gnome|test" LOG="/tmp/$(basename $0 .sh).log" # Check if we have the tarball before. if [ ! -f $SOURCE_DIR/$TARBALL ]; then echo "Downloading OppenOffice.org 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 abort_package 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 || abort_package "Failed to extract $TARBALL" status # extracted pkg can be removed: Save RAM rm -rf $SOURCE_DIR cd $TEMP_DIR/*/RPMS # Extract everything from RPMS for i in *.rpm do if (! echo $i | egrep -qi $EXCLUDE); then (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 # Make the package USR=$PACKAGE-$VERSION/fs/usr mkdir -p $USR/lib/openoffice $USR/share # use mv instead of 'cp -a' to save RAM mv opt/openoffice* $USR/lib/openoffice mv usr/share/mime usr/share/icons $USR/share mv usr/bin $USR # relocalized OOo libexec directory sed -i 's#/opt/#/usr/lib/openoffice/#' $USR/bin/openoffice* # Create receipt cat > $PACKAGE-$VERSION/receipt <> \ $ROOT/var/lib/tazpkg/installed.md5 [ -s $1/description.txt $ROOT/var/lib/tazpkg/installed/$PACKAGE ( cd fs ; find *) | sed 's|^|/|' > \ $ROOT/var/lib/tazpkg/installed/$PACKAGE/files.list if grep -q ^CONFIG_FILES= $1/receipt ; then cd fs find $( . ./receipt ; echo " $CONFIG_FILES" | sed 's| /| |g') |\ cpio -o -H newc | gzip -9 > \ $ROOT/var/lib/tazpkg/installed/$PACKAGE/volatile.cpio.gz for i in $( . ./receipt ; echo $CONFIG_FILES) ; do [ -e $ROOT$i ] && rm -rf .$i done cd .. fi sed -i "s/^PACKAGE=/UNPACKED_SIZE=\"$(du -chs $1 | sed '$!d;s/.total//')\"\n&/" \ $1/receipt cp $1/receipt $ROOT/var/lib/tazpkg/installed/$PACKAGE echo "Compute md5sum..." find fs -type f | xargs md5sum | sed 's| fs/| /|' > \ $ROOT/var/lib/tazpkg/installed/$PACKAGE/md5sum echo "Move files..." ( cd $1/fs ; find ) | while read file ; do [ -e $1/fs/$file -a ! -e $ROOT/$file ] && mv $1/fs/$file $(dirname $ROOT/$file) done }