[openwrt/openwrt] build: create tmp/userids file

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 14 07:15:35 EDT 2020


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/34cc2c9a99f6542f009aa660790061f169aa96b3

commit 34cc2c9a99f6542f009aa660790061f169aa96b3
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Sun Sep 13 15:55:52 2020 -1000

    build: create tmp/userids file
    
    Multiple packages contain a USERID variable defining required user and
    group for the package to run. With the recent addition of
    "PKG_FILE_MODES" it is possible to define user and group of specific
    files, replacing (possibly insecure) post-inst scripts. These modes are
    set during build time and put directly into the packages.
    
    To allow user and group names rather than the numeric values, a mapping
    like `/etc/passwd` is required by the `ipkg-build` script, mapping names
    defined in "PKG_FILE_MODES" to a numeric value, as the build system does
    not create any users during build.
    
    This commit adds a single line to the `prepare-tmpinfo` target, so that
    everytime the feeds are updated the *passwd like* content of
    `./tmp/userids` is updated.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 include/toplevel.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/toplevel.mk b/include/toplevel.mk
index c7e71ad571..589af94075 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -92,6 +92,7 @@ prepare-tmpinfo: FORCE
 	./scripts/package-metadata.pl mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
 	./scripts/package-metadata.pl pkgaux tmp/.packageinfo > tmp/.packageauxvars || { rm -f tmp/.packageauxvars; false; }
 	touch $(TOPDIR)/tmp/.build
+	grep "Require-User" tmp/.packageinfo | cut -d ' ' -f 2- | sort -u | grep "=" > tmp/userids
 
 .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo)
 	@+if [ \! -e .config ] || ! grep CONFIG_HAVE_DOT_CONFIG .config >/dev/null; then \



More information about the lede-commits mailing list