From patchwork Fri Sep 4 22:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Spooren X-Patchwork-Id: 1357858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aparcar.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=PFwIvjE1; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BjtBX1gQ2z9sSP for ; Sat, 5 Sep 2020 08:48:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=aO60KPohCcIERj5SCvpVgEsazHcSUdD9JATepCj5X+k=; b=PFwIvjE1SWGoqTMJM6JtrXKLHW OdMsTIyGLN/IGAJqvpS/inL5+BgIyv6E42Uvzdovnj8TpojOM8DjdrykGJB0kJZen23U8HW5R3XHD g1FbtuSFlOEwIlldUhsnkzyBuyBbNJwUTBY2ETTlqPgNqgBli3WgsWXoe3unDUfir58b1Lo/4ovHd 8l9EE7G/dpsUf/P0P4dGIua/9j3K3XP3os7aAx9sTCSFIaNeg0uhaxiQTqCwM5xnHIhTsLt/vRr+K 7aNeZ18aOkR5k0B5UVp3a38bBA+AyuUqwNNz1IprrU06ST+TwFnZjA2u6wyHxzFiGr9PGgF+ONWcJ WdZJjvuw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEKTw-0004Vs-Vb; Fri, 04 Sep 2020 22:46:57 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEKTs-0004V3-UF for openwrt-devel@lists.openwrt.org; Fri, 04 Sep 2020 22:46:54 +0000 X-Originating-IP: 72.234.141.215 Received: from dawn.lan (udp224251uds.hawaiiantel.net [72.234.141.215]) (Authenticated sender: mail@aparcar.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPA id E473620002; Fri, 4 Sep 2020 22:46:47 +0000 (UTC) From: Paul Spooren To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2] build: ipkg-build add -r option for all-root Date: Fri, 4 Sep 2020 12:46:35 -1000 Message-Id: <20200904224636.484105-1-mail@aparcar.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_184653_062483_A1851D8E X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.70.183.200 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Spooren Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The `ipkg-build` script create installable `ipk` packages. The newly added `-r` option attaches the `--owner=0 --group=0` to the `tar` command, allowing to run without a `fakeroot` context and still result in root-owned package contents. This approach is much faster than wrapping the packaging script with `fakeroot`. Signed-off-by: Paul Spooren --- scripts/ipkg-build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/ipkg-build b/scripts/ipkg-build index e3a9a882cf..38149c4432 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -1,5 +1,7 @@ #!/bin/sh +set -x + # ipkg-build -- construct a .ipk from a directory # Carl Worth # based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001 @@ -72,13 +74,14 @@ pkg_appears_sane() { # ipkg-build "main" ### file_modes="" -usage="Usage: $0 [-v] [-h] [-m] []" -while getopts "hvm:" opt; do +usage="Usage: $0 [-v] [-h] [-r] [-m] []" +while getopts "hvrm:" opt; do case $opt in v ) echo $version exit 0 ;; h ) echo $usage >&2 ;; + r ) TAR="$TAR --owner=0 --group=0" ;; m ) file_modes=$OPTARG ;; \? ) echo $usage >&2 esac