From patchwork Fri Sep 25 23:11:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Nieder X-Patchwork-Id: 50192 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8PNBpwe014796 for ; Fri, 25 Sep 2009 23:11:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707AbZIYXLq (ORCPT ); Fri, 25 Sep 2009 19:11:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752732AbZIYXLq (ORCPT ); Fri, 25 Sep 2009 19:11:46 -0400 Received: from mail-yw0-f174.google.com ([209.85.211.174]:45951 "EHLO mail-yw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbZIYXLq (ORCPT ); Fri, 25 Sep 2009 19:11:46 -0400 Received: by ywh4 with SMTP id 4so3292169ywh.33 for ; Fri, 25 Sep 2009 16:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=4I4eImUfDmP8jaFrE8Njxy0QGMT/8EypcFLo2Evy/tY=; b=iEfzufvPt6yPG3TM6EPvz0sQoWRHB5dhtZekyFExiZc1AweQrCF8pnUnm5MnOatczL HIAvm3Da1HnoiQI0zh7x0OjSJ1wyQP+geb3974sSmHVVqDLkDMiI1XTesozmrEhSEzLE OsE8tyx5Cswl0JIHkgDbYHXPnQEPrf38ka96A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=dD82Nu6TcTjysF/tlDH3nAR18uBz8YNSwCcmvfAdS4zMbprJlgvxP943rv7J/ppYql Mrb72yq1dzxawlimnoSOXZPbwLaGcmYkSO22sRcL/2PYER/eib58hs3XJ6osyoz+ctcq 4CejxYk/Znw0f1de8SJThPtbdueoIAuG6q7KE= Received: by 10.150.244.4 with SMTP id r4mr3446028ybh.127.1253919902868; Fri, 25 Sep 2009 16:05:02 -0700 (PDT) Received: from progeny.tock (c-98-212-3-231.hsd1.il.comcast.net [98.212.3.231]) by mx.google.com with ESMTPS id 21sm1808495yxe.13.2009.09.25.16.05.00 (version=SSLv3 cipher=RC4-MD5); Fri, 25 Sep 2009 16:05:01 -0700 (PDT) Date: Fri, 25 Sep 2009 18:11:56 -0500 From: Jonathan Nieder To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ryan Anderson Subject: [PATCH 1/2] kbuild: scripts/package: use $(ROOTCMD) to become root Message-ID: <20090925231156.GA28714@progeny.tock> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Use the value of the ROOTCMD variable as a command to acquire root or fake root privileges for "make tar-pkg" et al. So now you can do $ make oldconfig rpm-pkg ROOTCMD="fakeroot -u" as a shortcut for $ make oldconfig && > make && > fakeroot -u make rpm-pkg In the future, ROOTCMD="fakeroot -u" could be set automatically when not running as root and fakeroot is found on the path, so that "make oldconfig deb-pkg" would just work without fuss. Idea from Ryan Anderson . Signed-off-by: Jonathan Nieder --- Thoughts? Thanks, Jonathan scripts/package/Makefile | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fa4a0a1..a5d9088 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -44,7 +44,8 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version - $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz + $(ROOTCMD) $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) \ + -ta ../$(KERNELPATH).tar.gz rm ../$(KERNELPATH).tar.gz clean-files := $(objtree)/kernel.spec @@ -61,8 +62,8 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version - $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ - $(UTS_MACHINE) -bb $< + $(ROOTCMD) $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" \ + --target $(UTS_MACHINE) -bb $< clean-files += $(objtree)/binkernel.spec @@ -70,7 +71,7 @@ clean-files += $(objtree)/binkernel.spec # --------------------------------------------------------------------------- deb-pkg: FORCE $(MAKE) KBUILD_SRC= - $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb + $(ROOTCMD) $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb clean-dirs += $(objtree)/debian/ @@ -79,7 +80,7 @@ clean-dirs += $(objtree)/debian/ # --------------------------------------------------------------------------- tar%pkg: FORCE $(MAKE) KBUILD_SRC= - $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ + $(ROOTCMD) $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ clean-dirs += $(objtree)/tar-install/ @@ -87,10 +88,10 @@ clean-dirs += $(objtree)/tar-install/ # Help text displayed when executing 'make help' # --------------------------------------------------------------------------- help: FORCE + @echo ' Set ROOTCMD={sudo|fakeroot -u|super|...} and make as non-root:' @echo ' rpm-pkg - Build both source and binary RPM kernel packages' @echo ' binrpm-pkg - Build only the binary kernel package' @echo ' deb-pkg - Build the kernel as an deb package' @echo ' tar-pkg - Build the kernel as an uncompressed tarball' @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' -