Moved debian-tools (from CVS) to here.
[git-tools-moved-to-github.git] / id-deb-build / id-mk-deb-src.sh
diff --git a/id-deb-build/id-mk-deb-src.sh b/id-deb-build/id-mk-deb-src.sh
new file mode 100755 (executable)
index 0000000..84814e4
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Makes Debian source for package in deb-src
+# The current directory should hold a .tar.gz (dist) for the package
+# And the current directory should hold a debian and a corresponding changelog
+DEBCHANGELOG=debian/changelog
+if test ! -f $DEBCHANGELOG; then
+       echo "$DEBCHANGELOG missing"
+       echo "The current directory should be base source of package"
+       exit 1
+fi
+if test -d deb-src; then
+       echo "deb-src exist. You might remove it"
+       exit 1
+fi
+l=`head -1 $DEBCHANGELOG`
+PROD=`echo $l|sed 's/ .*//g'`
+VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
+echo "VERSION=$VERSION"
+MAJOR=`echo $VERSION|sed 's/-.*//g'`
+echo "MAJOR=$MAJOR"
+MINOR=`echo $VERSION|sed 's/.*-//g'`
+echo "MINOR=$MINOR"
+TAR=${PROD}-${MAJOR}.tar.gz
+if test ! -f ${TAR}; then
+       echo "$0: ${TAR} missing"
+       exit 1
+fi
+set -e
+mkdir deb-src
+ORIG=${PROD}_${MAJOR}.orig.tar.gz
+echo "TAR=$TAR"
+echo "ORIG=$ORIG"
+cp ${TAR} deb-src/${ORIG}
+cd deb-src
+tar xf ${ORIG}
+cp -r ../debian ${PROD}-${MAJOR}
+dpkg-source -b ${PROD}-${MAJOR}
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 8
+# End: