]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
attempt to fix #55
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 25 Jan 2009 00:17:15 +0000 (00:17 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 25 Jan 2009 00:17:15 +0000 (00:17 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@774 04377dda-e619-0410-9926-eae83683ac58

trunk/src/createpkg

index bbb0a4b2f7732427d7f4d1d689cfd4506647551c..fdd855eea1e15b9276ddcc739250ce301c55adf9 100644 (file)
@@ -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