Less verbose id-mk-deb-src.sh
[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 -f debian/.gitignore; then
12         cd debian; for i in `cat .gitignore`; do rm -fr $i; done; cd ..
13 fi
14 l=`head -1 $DEBCHANGELOG`
15 PROD=`echo $l|sed 's/ .*//g'`
16 VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
17 MAJOR=`echo $VERSION|sed 's/-.*//g'`
18 MINOR=`echo $VERSION|sed 's/.*-//g'`
19 TAR=${PROD}-${MAJOR}.tar.gz
20 if test ! -f ${TAR}; then
21         echo "$0: ${TAR} missing"
22         exit 1
23 fi
24 set -e
25 mkdir -p deb-src
26 ORIG=${PROD}_${MAJOR}.orig.tar.gz
27 cp ${TAR} deb-src/${ORIG}
28 cd deb-src
29 tar xf ${ORIG}
30 cp -r ../debian ${PROD}-${MAJOR}
31 dpkg-source -b ${PROD}-${MAJOR}
32 # Local Variables:
33 # mode:shell-script
34 # sh-indentation: 2
35 # sh-basic-offset: 8
36 # End: