aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trunk/src/createpkg16
1 files changed, 15 insertions, 1 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index bbb0a4b..fdd855e 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -727,6 +727,20 @@ eecho $messag "$BASENAME: processing $SCRIPT_NAME"
# Change to script base directory
cd $SCRIPT_BASE
+# Use fakeroot if needed and available
+if [ "`whoami`" != "root" ]; then
+ FAKEROOT="`which fakeroot`"
+ if [ "$?" == "0" ]; then
+ FAKEROOT="$FAKEROOT --"
+ else
+ eecho $messag "$BASENAME: WARNING: not running as root and no fakeroot found."
+ eecho $messag "$BASENAME: WARNING: your build might not be successful."
+ FAKEROOT=""
+ fi
+else
+ FAKEROOT=""
+fi
+
# Run SlackBuild script
[ $DEBUG -eq $off ] && SHELL_FLAG="+x" || SHELL_FLAG="-x"
(
@@ -738,7 +752,7 @@ cd $SCRIPT_BASE
COLOR=${COLOR:=$COLOR_MODE} \
REPOS=${REPOS:=$PACKAGES_DIR} \
CLEANUP=${CLEANUP:=$CREATEPKG_CLEANUP} \
- INTERACT=no sh $SHELL_FLAG ./$SCRIPT_NAME
+ INTERACT=no $FAKEROOT sh $SHELL_FLAG ./$SCRIPT_NAME
)
# Check if package was built