makepackage 935 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # given source tree build .tar.gz and package for distribution on this host
  3. os=$(uname)
  4. if [ -f /etc/redhat-release ]; then
  5. DISTRO="RedHat"
  6. DVER=$(cat /etc/redhat-release | cut -d " " -f5-)
  7. elif [ -f /etc/SuSE-release ]; then
  8. DISTRO="SuSE"
  9. DVER=$(cat /etc/SuSE-release | head -n1 | cut -d " " -f3)
  10. elif [ -f /etc/debian_version ]; then
  11. DISTRO="Debian"
  12. DVER=$(cat /etc/debian_version)
  13. else
  14. DISTRO=$os
  15. fi
  16. version=$(./version)
  17. if [ "$DISTRO" == "RedHat" ]; then
  18. mkdir -p /tmp/pptpd-$version
  19. cp -ar * /tmp/pptpd-$version/
  20. cd /tmp
  21. tar -czf /usr/src/redhat/SOURCES/pptpd-$version.tar.gz pptpd-$version
  22. cd -
  23. rpmbuild -ba pptpd.spec
  24. elif [ "$DISTRO" == "Debian" ]; then
  25. DPKG_BP=`which dpkg-buildpackage 2>/dev/null`
  26. if [ -z "$DPKG_BP" ]; then
  27. echo "dpkg-buildpackage not installed. Do: apt-get install dpkg-dev"
  28. exit 1
  29. fi
  30. $DPKG_BP -rfakeroot
  31. else
  32. echo "No packagebuilder implemented yet."
  33. fi