openoffice-langpack.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. # Slackware build script for OpenOffice Language Packs
  3. #
  4. # Adapted from Slackware build scripts for LibreOffice Language Packs by
  5. # Niels Horn, Rio de Janeiro, RJ, Brazil (Copyright 2010-2014) and
  6. # Willy Sudiarto Raharjo (Copyright 2014-2017)
  7. # Copyright 2017 Ekin Akoglu, Erdemli, Mersin, Turkey
  8. #
  9. # Permission is hereby granted, free of charge, to any person obtaining
  10. # a copy of this software and associated documentation files (the “Software”),
  11. # to deal in the Software without restriction, including without limitation
  12. # the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  13. # sell copies of the Software, and to permit persons to whom the Software is
  14. # furnished to do so, subject to the following conditions:
  15. # The above copyright notice and this permission notice shall be included
  16. # in all copies or substantial portions of the Software.
  17. # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
  18. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  21. # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  22. # IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=openoffice-langpack
  25. VERSION=${VERSION:-"4.1.6"}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. OOLANG=${OOLANG:-en-GB}
  30. PKG_LANG=${OOLANG//-/_}
  31. # I'll leave this line here, as I always have to change it with every release
  32. SRCVERSION=$VERSION
  33. SRCSHORT=$(echo $VERSION | cut -f1 -d.)
  34. if [ -z "$ARCH" ]; then
  35. case "$( uname -m )" in
  36. i?86) ARCH=i586 ;;
  37. arm*) ARCH=arm ;;
  38. *) ARCH=$( uname -m ) ;;
  39. esac
  40. fi
  41. # Change source package name
  42. if [ "$ARCH" = "x86_64" ]; then
  43. SRCARCH="x86-64"
  44. PKGARCH="$ARCH"
  45. LIBDIRSUFFIX=64
  46. elif [ "$ARCH" = "arm" ]; then
  47. printf "\n$ARCH is unsupported for Apache OpenOffice...\n\n"
  48. exit 1
  49. else
  50. SRCARCH="x86"
  51. PKGARCH="i586"
  52. LIBDIRSUFFIX=""
  53. fi
  54. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  55. # the name of the created package would be, and then exit. This information
  56. # could be useful to other scripts.
  57. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  58. echo "$PRGNAM-${VERSION}_${PKG_LANG}-$PKGARCH-$BUILD$TAG.$PKGTYPE"
  59. exit 0
  60. fi
  61. TMP=${TMP:-/tmp/SBo}
  62. PKG=$TMP/package-$PRGNAM
  63. OUTPUT=${OUTPUT:-/tmp}
  64. set -e
  65. # Concatenate all parts to get the full name of the tarball
  66. TARBALL="Apache_OpenOffice_${SRCVERSION}_Linux_${SRCARCH}_langpack-rpm_${OOLANG}.tar.gz"
  67. if [ ! -r $TARBALL ]; then
  68. echo "$TARBALL not found"
  69. exit 1
  70. fi
  71. # Get "base" directory of tarball
  72. SOURCEDIR=$(tar tzf $CWD/$TARBALL 2>/dev/null | head -n 1 | tr -d \/)
  73. rm -rf $PKG
  74. mkdir -p $TMP $PKG $OUTPUT
  75. rm -rf $TMP/$SOURCEDIR
  76. tar xvf $CWD/$TARBALL -C $TMP
  77. cd $TMP/$SOURCEDIR/RPMS/
  78. for FILE in *.rpm ; do rpm2cpio < $FILE | cpio -imdv ; done
  79. mv opt $PKG
  80. cd $PKG
  81. # Move docs to their expected locations
  82. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  83. cd $PKG/opt/openoffice$SRCSHORT
  84. mv readmes $PKG/usr/doc/$PRGNAM-$VERSION
  85. cd -
  86. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  87. mkdir -p $PKG/install
  88. cat $CWD/slack-desc > $PKG/install/slack-desc
  89. # Fix ownership and permissions and make the package
  90. chown -R root:root .
  91. find . -type d -exec chmod 755 {} \;
  92. find -L . \
  93. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  94. -o -perm 511 \) -exec chmod 755 {} \; -o \
  95. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  96. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${PKG_LANG}-$PKGARCH-$BUILD$TAG.$PKGTYPE