Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/git-tools
[git-tools-moved-to-github.git] / id-deb-build / id-pbuild.sh
index b9cd94d..501eb6c 100755 (executable)
@@ -64,6 +64,18 @@ if test ! -x $PBUILDROOT; then
     exit 1
 fi
 
+MKDEBSRC=`dirname $0`/id-mk-deb-src.sh
+if test ! -x $MKDEBSRC; then
+    echo "$MKDEBSRC not found"
+    exit 1
+fi
+
+if test -d deb-src; then
+    cd deb-src
+else
+    $MKDEBSRC
+fi
+
 if test -d deb-src; then
     cd deb-src
 fi
@@ -113,9 +125,16 @@ if $upload; then
 fi
 rm -f *.log
 
+# call our privileged wrapper to clean the directories, no --dsc option
+for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
+    for arch in ${USE_ARCHS}; do
+       sudo -n $PBUILDROOT --dist=$dist --arch=$arch
+    done
+done
+
+# call our privileged wrapper to do the real work, with --dsc option
 i=0
 date
-
 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
     for arch in ${USE_ARCHS}; do
        sudo -n $PBUILDROOT \