#!/bin/bash # # openoffice.org-pl.SlackBuild # code: Vicious (michal@scxd.info); improvements: Zielony (e-pl@o2.pl) set -e # PACKAGE GENERAL INFO [EDIT] PKGNAME=openoffice.org-pl VERSION=2.4.1 BUILD=1X ARCH=i586 URL=http://mirror.icis.pcz.pl/OOO/localized/pl/$VERSION/OOo_"$VERSION"_LinuxIntel_install_pl.tar.gz #ftp://ftp.icm.edu.pl/packages/OpenOffice/official/localized/pl/$VERSION/OOo_"$VERSION"_LinuxIntel_install_pl.tar.gz CWD=`pwd` TMP=/tmp/$PKGNAME PKG=$TMP/package if [ ! -d $TMP/$PKGNAME-$VERSION ]; then rm -rf $PKG mkdir -p $PKG/install # PACKAGE DESCRIPTION [EDIT] cat << 'SLACKDESC' | fmt -w $(( 80 - `echo $PKGNAME | wc -c` - 3 )) | perl -pe "s/^/$PKGNAME: /" > $PKG/install/slack-desc OpenOffice.org (office suite) OpenOffice.org is both a multi-platform and multi-lingual office suite and an open-source project. Compatible with all other major office suites. Package prepared by Zielony (e-pl@o2.pl) SLACKDESC cd $TMP # step 1: DOWNLOAD SOURCE case "${URL//*\/}" in *.tar.bz2) EXTENSION="tar.bz2"; DECOMPRESS="tar jxvf" ;; *.tar.gz) EXTENSION="tar.gz"; DECOMPRESS="tar zxvf" ;; *.zip) EXTENSION="zip"; DECOMPRESS="unzip" ;; esac PKGFNAME="$PKGNAME-$VERSION.$EXTENSION" ( wget -c $URL -P $TMP -O $PKGFNAME ) # step 2: UNPACK SOURCE AND PREPARE PACKAGE $DECOMPRESS $PKGFNAME DIRNAME=`ls -c | head -1 | cut -d / -f 1` if [ "$DIRNAME" != "$PKGNAME-$VERSION" ]; then mv $DIRNAME $PKGNAME-$VERSION; fi chown root:root $TMP -R fi cd $TMP/$PKGNAME-$VERSION/RPMS if [ ! -d $PKG/usr ]; then rpm2tgz desktop-integration/openoffice.org-freedesktop-menus-*.noarch.rpm rpm2tgz *.rpm explodepkg *.tgz cp -af opt usr $PKG rm -rf $PKG/usr/share/applications fi ( mv -f $PKG/opt/openoffice.org${VERSION%.*}/share/xdg $PKG/usr/share/applications && \ for i in $PKG/usr/share/applications/*; do mv -f $i $PKG/usr/share/applications/openoffice.org-`basename $i` done ) sed -i 's@etc/@opt/@g' $PKG/usr/bin/openoffice.org* ln -sf /opt/openoffice.org${VERSION%.*}/program/soffice $PKG/usr/bin/soffice ln -sf /opt/openoffice.org${VERSION%.*}/program/unopkg $PKG/usr/bin/unopkg # step 3: STRIP BINARIES & GZIP MANUALS cd $PKG ( find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : \ | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : \ | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "current ar archive" | grep ELF | cut -f 1 -d : \ | xargs strip --strip-debug 2> /dev/null ) find $PKG/usr -regex '.+/man/\(.+?/\)?man./.+' -exec gzip -9 \{} \; # step 4: CREATE PACKAGE & CLEAN TMP if [ `find . | wc -l` -le 1 ]; then echo "Brak plików pakietu!" else ( requiredbuilder -y -s $PKG/install $PKG ) makepkg -l y -c n $CWD/$PKGNAME-$VERSION-$ARCH-$BUILD.tgz if [ "$1" != "-nc" ]; then rm -rf $TMP; fi fi