CVS java-package

Jeroen van Wolffelaar jeroen@haydn.debian.org
Sun Jul 10 16:52:02 2005


Update of /cvsroot/pkg-java/java-package
In directory haydn:/tmp/cvs-serv29979

Modified Files:
	make-jpkg 
Log Message:
* Re-exec with fakeroot if needed (Closes: ##310132)


--- /cvsroot/pkg-java/java-package/make-jpkg	2005/01/24 23:07:35	1.7
+++ /cvsroot/pkg-java/java-package/make-jpkg	2005/07/10 16:51:08	1.8
@@ -17,6 +17,7 @@
 maintainer_name="$J2SE_PACKAGE_FULL_NAME"
 maintainer_email="$J2SE_PACKAGE_EMAIL"
 genchanges=""
+faker00ted=false
 
 
 ### Parse options
@@ -71,6 +72,8 @@
 	maintainer_email="$1"
     elif [[ "x$1" == x--changes ]]; then
 	genchanges="true"
+    elif [[ "x$1" == x--faker00ted ]]; then
+	faker00ted="true"
     else
 	unrecognized_option "$1"
     fi
@@ -99,10 +102,13 @@
 archive_dir="$( cd "$( dirname "$archive" )" ; pwd )"
 archive_path="$archive_dir/$archive_name"
 
-
-# must be run as root
-if ! dh_testroot; then
-    exit 1
+# must be run as fakeroot
+if ! dh_testroot >/dev/null 2>&1; then
+	if $faker00ted; then
+		echo "Internal error, fakeroot seems to fail faking root" >&2
+		exit 1
+	fi
+	exec fakeroot "$0" --faker00ted "$@"
 fi
 
 # check whether I'm real root, and bail out if so... ugly, but needed