OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / pptpd / makepackage
1 #!/bin/bash
2 # given source tree build .tar.gz and package for distribution on this host
3
4 os=$(uname)
5 if [ -f /etc/redhat-release ]; then
6    DISTRO="RedHat"
7    DVER=$(cat /etc/redhat-release | cut -d " " -f5-)
8 elif [ -f /etc/SuSE-release ]; then
9    DISTRO="SuSE"
10    DVER=$(cat /etc/SuSE-release | head -n1 | cut -d " " -f3)
11 elif [ -f /etc/debian_version ]; then
12    DISTRO="Debian"
13    DVER=$(cat /etc/debian_version)
14 else
15    DISTRO=$os
16 fi
17
18 version=$(./version)
19
20 if [ "$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
27 elif [ "$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
34 else
35  echo "No packagebuilder implemented yet."
36 fi