From d68c2e291224f23b28868b90f9ddedcc0531ae26 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 29 Mar 2011 12:23:30 +0000
Subject: [PATCH] abuild: fakeroot fix when running as root

---
 abuild.in | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/abuild.in b/abuild.in
index 4a8d026406c2..1dc63fbcf71a 100755
--- a/abuild.in
+++ b/abuild.in
@@ -899,6 +899,14 @@ is_function() {
 	type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function"
 }
 
+do_fakeroot() {
+	if [ -n "$FAKEROOT" ]; then
+		$FAKEROOT -- "$@"
+	else
+		"$@"
+	fi
+}
+
 # build and package in fakeroot
 rootpkg() {
 	local do_build=build
@@ -909,7 +917,7 @@ rootpkg() {
 	fi
 	cd "$startdir"
 	[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
-	$FAKEROOT -- "$abuild_path" $color_opt $do_build \
+	do_fakeroot "$abuild_path" $color_opt $do_build \
 		prepare_subpackages \
 		prepare_language_packs \
 		prepare_package \
-- 
GitLab