[PATCH 1/2] build: ipkg-build add -r option for all-root

Paul Spooren mail at aparcar.org
Fri Sep 4 18:46:35 EDT 2020


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 <mail at aparcar.org>
---
 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 <cworth at east.isi.edu>
 # based on a script by Steve Redler IV, steve at sr-tech.com 5-21-2001
@@ -72,13 +74,14 @@ pkg_appears_sane() {
 # ipkg-build "main"
 ###
 file_modes=""
-usage="Usage: $0 [-v] [-h] [-m] <pkg_directory> [<destination_directory>]"
-while getopts "hvm:" opt; do
+usage="Usage: $0 [-v] [-h] [-r] [-m] <pkg_directory> [<destination_directory>]"
+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
-- 
2.25.1




More information about the openwrt-devel mailing list