pastebinit.SlackBuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash
  2. # Slackware build script for pastebinit
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20191219 bkw:
  6. # - BUILD=2
  7. # - Make sprunge.us actually be the default (broken sed command!)
  8. # - Add note to README about which services still work.
  9. # 20150116 bkw:
  10. # - Fix shebang line so python3 isn't required.
  11. # - Change default server to sprunge.us, since we now get
  12. # 'invalid_api_key' trying to use the default pastebin.com.
  13. # I guess nobody's using this, or I would have gotten bug reports.
  14. cd $(dirname $0) ; CWD=$(pwd)
  15. PRGNAM=pastebinit
  16. VERSION=${VERSION:-1.5}
  17. BUILD=${BUILD:-2}
  18. TAG=${TAG:-_SBo}
  19. PKGTYPE=${PKGTYPE:-tgz}
  20. ARCH=noarch
  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. set -e
  29. rm -rf $PKG
  30. mkdir -p $TMP $PKG $OUTPUT
  31. cd $TMP
  32. rm -rf $PRGNAM-$VERSION
  33. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  34. cd $PRGNAM-$VERSION
  35. chown -R root:root .
  36. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  37. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  38. # Get rid of the fixmes in the man page.
  39. patch -p1 < $CWD/manpagefix.diff
  40. # 20150116 bkw:
  41. sed -i \
  42. -e '1s,python3$,python,' \
  43. -e '/^defaultPB/s,=.*,= "sprunge.us",' \
  44. $PRGNAM
  45. mkdir -p \
  46. $PKG/usr/bin \
  47. $PKG/usr/share/pastebin.d \
  48. $PKG/usr/share/locale \
  49. $PKG/usr/man/man1 \
  50. # No Makefile, manual installation.
  51. install -m0755 -oroot -groot $PRGNAM $PKG/usr/bin
  52. install -m0755 -oroot -groot utils/pbput $PKG/usr/bin
  53. ln -s pbput $PKG/usr/bin/pbget
  54. ln -s pbput $PKG/usr/bin/pbputs
  55. install -m0644 pastebin.d/* $PKG/usr/share/pastebin.d
  56. # Translations.
  57. cd po
  58. make
  59. cp -a mo/* $PKG/usr/share/locale
  60. cd -
  61. # Generate the main man page. pbput man page is prebuilt by upstream.
  62. # If this fails, you have multiple versions of linuxdoc-tools installed!
  63. xsltproc \
  64. /usr/share/xml/docbook/xsl-stylesheets-*/manpages/docbook.xsl \
  65. $PRGNAM.xml
  66. # Install all the man pages.
  67. gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  68. gzip -9c < utils/pbput.1 > $PKG/usr/man/man1/pbput.1.gz
  69. ln -s pbput.1.gz $PKG/usr/man/man1/pbget.1.gz
  70. ln -s pbput.1.gz $PKG/usr/man/man1/pbputs.1.gz
  71. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  72. cp -a COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. mkdir -p $PKG/install
  75. cat $CWD/slack-desc > $PKG/install/slack-desc
  76. cd $PKG
  77. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE