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