asr-manpages.SlackBuild 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/bash
  2. # Slackware build script for asr-manpages
  3. # Copyright 2007-2008 Michiel van Wessem, Manchester, United Kingdom
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are
  8. # met:
  9. #
  10. # * Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  14. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  15. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  16. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  17. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  19. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=asr-manpages
  26. VERSION=${VERSION:-1.3.6}
  27. SRC_VERSION=$( echo $VERSION | cut -d. -f1,2 )
  28. DEB_VERSION=6
  29. # Hard code the ARCH as this is truly architecture independent
  30. ARCH=noarch
  31. BUILD=${BUILD:-1}
  32. TAG=${TAG:-_SBo}
  33. PKGTYPE=${PKGTYPE:-tgz}
  34. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  35. # the name of the created package would be, and then exit. This information
  36. # could be useful to other scripts.
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf $PRGNAM-$SRC_VERSION
  49. tar xvf $CWD/${PRGNAM}_$SRC_VERSION.orig.tar.gz
  50. cd $PRGNAM-$SRC_VERSION.orig
  51. # Patch the manpages to the latest version.
  52. patch -p1 < $CWD/${PRGNAM}_$SRC_VERSION-$DEB_VERSION.diff
  53. chown -R root:root .
  54. find -L . \
  55. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  56. -exec chmod 755 {} \; -o \
  57. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  58. -exec chmod 644 {} \;
  59. # Create the directories we need
  60. mkdir -p $PKG/usr/man/man{1,2,3,5,7,8}
  61. install -m 0644 $CWD/google.7 $PKG/usr/man/man7/google.7fun
  62. for manpage in $(echo *fun); do
  63. section=$(echo $manpage | awk -F. '{print $2}' | colrm 2 4)
  64. install -m 0644 $manpage $PKG/usr/man/man$section/$manpage
  65. done
  66. ( cd $PKG/usr/man
  67. find . -type f -exec gzip -9 {} \;
  68. for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  69. )
  70. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  71. cp -a debian/changelog debian/copyright $PKG/usr/doc/$PRGNAM-$VERSION
  72. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  73. mkdir -p $PKG/install
  74. cat $CWD/slack-desc > $PKG/install/slack-desc
  75. cd $PKG
  76. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE