scripts/package: add KBUILD_PKG_ROOTCMD variable
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 24 Nov 2009 15:14:41 +0000 (09:14 -0600)
committerMichal Marek <mmarek@suse.cz>
Sat, 12 Dec 2009 12:08:15 +0000 (13:08 +0100)
Let the deb-pkg target acquire (fake) root privileges before
running commands that need them.  Without such privileges,
deb-pkg errors out because chown fails.

The new KBUILD_PKG_ROOTCMD variable, if defined, is used as a
command to run other commands with possibly fake elevated
privileges.  Since this is not needed for the tar-pkg and rpm-pkg
targets, it is only used by deb-pkg.  If it is not defined, the
behavior is as before, and the user will have to rerun make as
root.

In other words, as a shortcut, instead of running 'make oldconfig &&
make && fakeroot -u make deb-pkg', one can use the single command
'make oldconfig deb-pkg KBUILD_PKG_ROOTCMD="fakeroot -u"'.

Suggested-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/package/Makefile

index f67cc885c807f0649b508a534d19566dd4de9abe..5c0b43aaf63b14cac30ae0f006161ca3d3082c15 100644 (file)
@@ -79,7 +79,8 @@ clean-files += $(objtree)/binkernel.spec
 # ---------------------------------------------------------------------------
 deb-pkg: FORCE
        $(MAKE) KBUILD_SRC=
-       $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
+       $(KBUILD_PKG_ROOTCMD) $(CONFIG_SHELL) \
+               $(srctree)/scripts/package/builddeb
 
 clean-dirs += $(objtree)/debian/