id-pbuild.sh: call mk-deb-src when running as normal user
[git-tools-moved-to-github.git] / id-deb-build / id-pbuild.sh
index fdb1442..b1d586a 100755 (executable)
@@ -72,13 +72,20 @@ if test ! -x $MKDEBSRC; then
     exit 1
 fi
 
-if test -d deb-src; then
+if $upload; then
     cd deb-src
 else
-    $MKDEBSRC
-fi
-
-if test -d deb-src; then
+    if test "${SUDO_USER}"; then
+       if test ! -d deb-src; then
+           $MKDEBSRC
+       fi
+    else
+       if test -d deb-src; then
+           echo "Remove deb-src"
+           exit 1
+       fi
+       $MKDEBSRC
+    fi
     cd deb-src
 fi