cvsd.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. # Generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST
  3. # Copyright 2009 Eric Hameleers <alien@slackware.com>, Eindhoven, Netherlands
  4. # Slackware build script for drbd
  5. # Written by Zordrak <sbo@tpa.me.uk>
  6. # Based on http://slackbuilds.org/template.SlackBuild
  7. cd $(dirname $0) ; CWD=$(pwd)
  8. PRGNAM=cvsd
  9. VERSION=${VERSION:-1.0.24}
  10. BUILD=${BUILD:-1}
  11. TAG=${TAG:-_SBo}
  12. PKGTYPE=${PKGTYPE:-tgz}
  13. if [ -z "$ARCH" ]; then
  14. case "$( uname -m )" in
  15. i?86) ARCH=i486 ;;
  16. arm*) ARCH=arm ;;
  17. *) ARCH=$( uname -m ) ;;
  18. esac
  19. fi
  20. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  21. # the name of the created package would be, and then exit. This information
  22. # could be useful to other scripts.
  23. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  24. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  25. exit 0
  26. fi
  27. TMP=${TMP:-/tmp/SBo}
  28. PKG=$TMP/package-$PRGNAM
  29. OUTPUT=${OUTPUT:-/tmp}
  30. if [ "$ARCH" = "i486" ]; then
  31. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "i686" ]; then
  34. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "x86_64" ]; then
  37. SLKCFLAGS="-O2 -fPIC"
  38. LIBDIRSUFFIX="64"
  39. fi
  40. set -e
  41. # Bail out if user or group isn't valid on your system
  42. # For slackbuilds.org, assigned cvsd uid/gid are 233/233
  43. # See http://slackbuilds.org/uid_gid.txt
  44. if ! grep ^cvsd: /etc/group 2>&1 > /dev/null; then
  45. echo " You must have a \"cvsd\" group to run this script."
  46. echo " # groupadd -g 233 cvsd"
  47. exit 1
  48. elif ! grep ^cvsd: /etc/passwd 2>&1 > /dev/null; then
  49. echo " You must have a \"cvsd\" user to run this script."
  50. echo " # useradd -u 233 -g cvsd -d /srv/cvsd -s /bin/false cvsd"
  51. exit 1
  52. fi
  53. rm -rf $PKG
  54. mkdir -p $TMP $PKG $OUTPUT
  55. cd $TMP
  56. rm -rf $PRGNAM-$VERSION
  57. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  58. cd $PRGNAM-$VERSION
  59. chown -R root:root .
  60. find -L . \
  61. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  62. -o -perm 511 \) -exec chmod 755 {} \; -o \
  63. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  64. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  65. CFLAGS="$SLKCFLAGS" \
  66. CXXFLAGS="$SLKCFLAGS" \
  67. ./configure \
  68. --prefix=/usr \
  69. --libdir=/usr/lib${LIBDIRSUFFIX} \
  70. --sysconfdir=/etc \
  71. --localstatedir=/var \
  72. --mandir=/usr/man \
  73. --docdir=/usr/doc/$PRGNAM-$VERSION \
  74. --build=$ARCH-slackware-linux
  75. make
  76. make install DESTDIR=$PKG
  77. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  78. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  79. find $PKG/usr/man -type f -exec gzip -9 {} \;
  80. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  81. mkdir -p $PKG/etc/rc.d
  82. mv $PKG/etc/init.d/cvsd $PKG/etc/rc.d/rc.cvsd.new
  83. rmdir $PKG/etc/init.d
  84. mv $PKG/etc/cvsd/cvsd.conf $PKG/etc/cvsd/cvsd.conf.new
  85. sed -i 's/\/var\/lib\/cvsd/\/srv\/cvsd/g' $PKG/etc/cvsd/cvsd.conf.new
  86. sed -i 's/^Repos/# Repos/g' $PKG/etc/cvsd/cvsd.conf.new
  87. sed -i 's/^#Listen \* 2401/Listen 0.0.0.0 2401/g' $PKG/etc/cvsd/cvsd.conf.new
  88. mkdir -p $PKG/srv/cvsd
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. cp -a AUTHORS COPYING ChangeLog* FAQ INSTALL NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  91. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  92. mkdir -p $PKG/install
  93. cat $CWD/slack-desc > $PKG/install/slack-desc
  94. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  95. cd $PKG
  96. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE