# Maintainer : Mark E. Lee pkgname=libreoffice-rpm pkgver=4.0 pkgrel=0 pkgpat=3 pkgdesc="LGPL Office Suite Help Pack installed from rpms" arch=('i686' 'x86_64') url='http://www.libreoffice.org' license=('LGPL') depends=('glibc>=2.5' 'gtk2>=2.10.4' 'linux>=2.6.18' 'xorg-server' 'libreoffice-rpm') makedepends=('rpmextract' 'wget' 'awk') optdepends=('jre7-openjdk' 'gtk3' 'gnome') if [ "$(uname -m)" == "i686" ]; then ## convert bit architecture to libreoffice format arch_mod='x86'; md5sums+=('c0c60aedaf885c4c446783ac496bbe30'); source+=("http://download.documentfoundation.org/libreoffice/stable/${pkgver}.${pkgrel}/rpm/${arch_mod}/LibreOffice_${pkgver}.${pkgrel}_Linux_${arch_mod/_/-}_rpm.tar.gz") else arch_mod='x86_64'; md5sums+=('4d644278ef42137c508a062738288fe1') source+=("http://download.documentfoundation.org/libreoffice/stable/${pkgver}.${pkgrel}/rpm/${arch_mod}/LibreOffice_${pkgver}.${pkgrel}_Linux_${arch_mod/_/-}_rpm.tar.gz") fi; ## add additional packages wget -q "http://download.documentfoundation.org/libreoffice/stable/${pkgver}.${pkgrel}/rpm/${arch_mod}/"; ## get index.html declare -ar opt_pak=('langpack' 'helppack'); ## declare optional extensions for a in ${opt_pak[@]}; do ## loop for all optional extensions read -p "Do you want to install additional ${a} (Y/y/N/n)?" opt_ans; case $opt_ans in ## evaluate the answer Y|y) echo "Which ${a} do you want to install?"; ## generate a menu for all available packages select opt_ext in $(cat index.html | awk -F'_' "/${a}/ && !/.asc/ {print \$7}" | awk -F'.' '{print $1}'); do ## download the rpm package source+=("http://download.documentfoundation.org/libreoffice/stable/${pkgver}.${pkgrel}/rpm/${arch_mod}/LibreOffice_${pkgver}.${pkgrel}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz"); ## download the rpm md5 wget -q "http://download.documentfoundation.org/libreoffice/stable/${pkgver}.${pkgrel}/rpm/${arch_mod}/LibreOffice_${pkgver}.${pkgrel}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz.md5" ## extract and add md5sum to the array md5sums+=($(awk '{print $1}' "LibreOffice_${pkgver}.${pkgrel}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz.md5")); break; ## break the select loop done; ;; N|n) echo "Not installing additional $a"; ;; *) echo "Not a valid answer"; ;; esac; done; build () { ## build function cd ${srcdir}; ## enter the package source directory for a in $(ls -d */); do ## loop for all directories found cd "${srcdir}/${a}RPMS"; ## enter the RPMS directory for b in *.rpm; do ## loop for all rpm files found rpmextract.sh $b; ## extract the rpm files done; cp -rf opt ${pkgdir}/; ## copy/merge the opt directory to the package directory chmod 755 ${pkgdir}/opt; ## change directory permissions to read/write/execute for root, read/execute only for other users done; ## Get desktop icons for libreoffice cd ${srcdir}/LibreOffice_${pkgver}.${pkgrel}.${pkgpat}_Linux_${arch_mod/_/-}_rpm/RPMS/desktop-integration; ## enter the desktop integration directory rpmextract.sh libreoffice${pkgver}-freedesktop-menus-${pkgver}.${pkgrel}-103.noarch.rpm; ## extract the desktop files cp -r usr ${pkgdir}/; ## copy the usr directory to the package directory chmod 755 ${pkgdir}/usr; ## change directory permissions to read/write/execute for root, read/execute only for other users }