builddsrpm.sh 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh -v
  2. mkdirs() {
  3. for d in "$@" ; do
  4. if [ -d $d ]; then
  5. mv $d $d.deleted
  6. rm -rf $d.deleted &
  7. fi
  8. mkdir -p $d
  9. done
  10. }
  11. if [ ! -f $HOME/.rpmmacros ]; then
  12. echo "This script assumes you want to build as a non-root"
  13. echo "user and in a non-default place (e.g. your home dir)"
  14. echo "You must have a $HOME/.rpmmacros file that redefines"
  15. echo "_topdir e.g."
  16. echo "%_topdir /home/rmeggins/ds71"
  17. echo "Please create that file with the above contents and"
  18. echo "rerun this script."
  19. exit 1
  20. fi
  21. NAME=ldapserver
  22. VERSION=7.1
  23. # change HEAD to a real static tag when available
  24. CVSTAG=HEAD
  25. mkdirs SOURCES BUILD SRPMS RPMS
  26. cd SOURCES
  27. rm -rf $NAME-$VERSION $NAME-$VERSION.tar.gz
  28. echo "Checking out source code . . ."
  29. cvs export -r $CVSTAG -d $NAME-$VERSION $NAME > /dev/null 2>&1
  30. echo "Building tarball . . ."
  31. tar cf - $NAME-$VERSION | gzip > $NAME-$VERSION.tar.gz
  32. rm -rf $NAME-$VERSION
  33. cd ..
  34. echo "Executing rpmbuild . . ."
  35. rpmbuild -ba $NAME.spec
  36. echo "Finished doing rpmbuild $NAME.spec"