Moved debian-tools (from CVS) to here.
[git-tools-moved-to-github.git] / id-deb-build / id-mk-deb-src.sh
1 #!/bin/sh
2 # Makes Debian source for package in deb-src
3 # The current directory should hold a .tar.gz (dist) for the package
4 # And the current directory should hold a debian and a corresponding changelog
5 DEBCHANGELOG=debian/changelog
6 if test ! -f $DEBCHANGELOG; then
7         echo "$DEBCHANGELOG missing"
8         echo "The current directory should be base source of package"
9         exit 1
10 fi
11 if test -d deb-src; then
12         echo "deb-src exist. You might remove it"
13         exit 1
14 fi
15 l=`head -1 $DEBCHANGELOG`
16 PROD=`echo $l|sed 's/ .*//g'`
17 VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
18 echo "VERSION=$VERSION"
19 MAJOR=`echo $VERSION|sed 's/-.*//g'`
20 echo "MAJOR=$MAJOR"
21 MINOR=`echo $VERSION|sed 's/.*-//g'`
22 echo "MINOR=$MINOR"
23 TAR=${PROD}-${MAJOR}.tar.gz
24 if test ! -f ${TAR}; then
25         echo "$0: ${TAR} missing"
26         exit 1
27 fi
28 set -e
29 mkdir deb-src
30 ORIG=${PROD}_${MAJOR}.orig.tar.gz
31 echo "TAR=$TAR"
32 echo "ORIG=$ORIG"
33 cp ${TAR} deb-src/${ORIG}
34 cd deb-src
35 tar xf ${ORIG}
36 cp -r ../debian ${PROD}-${MAJOR}
37 dpkg-source -b ${PROD}-${MAJOR}
38 # Local Variables:
39 # mode:shell-script
40 # sh-indentation: 2
41 # sh-basic-offset: 8
42 # End: