mtasc.SlackBuild 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # Slackware build script for MTASC
  3. # Written by Andres Fuentes (rafu@riseup.net)
  4. # This script is public domain
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=mtasc
  7. VERSION=${VERSION:-1.15}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i586 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  19. # the name of the created package would be, and then exit. This information
  20. # could be useful to other scripts.
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i586" ]; then
  29. SRCTAR="$PRGNAM-$VERSION-linux.tgz"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SRCTAR="$PRGNAM-$VERSION-linux-$ARCH.tgz"
  33. LIBDIRSUFFIX="64"
  34. else
  35. printf "\n$ARCH is not supported.\n\n" ; exit 1
  36. fi
  37. set -e
  38. rm -rf $PKG
  39. mkdir -p $PKG/opt/$PRGNAM $OUTPUT
  40. tar xvf $CWD/$SRCTAR -C $PKG/opt/$PRGNAM
  41. chown -R root:root $PKG
  42. find $PKG \
  43. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  44. -exec chmod 755 {} \; -o \
  45. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  46. -exec chmod 644 {} \;
  47. mkdir -p $PKG/etc/profile.d/
  48. cat << EOF > $PKG/etc/profile.d/mtasc.sh
  49. #!/bin/sh
  50. export PATH="\${PATH}:/opt/mtasc"
  51. EOF
  52. cat << EOF > $PKG/etc/profile.d/mtasc.csh
  53. #!/bin/csh
  54. setenv PATH \${PATH}:/opt/mtasc
  55. EOF
  56. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  57. mv $PKG/opt/$PRGNAM/*.txt $PKG/usr/doc/$PRGNAM-$VERSION
  58. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  59. mkdir -p $PKG/install
  60. cat $CWD/slack-desc > $PKG/install/slack-desc
  61. cd $PKG
  62. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE