From 285012d8972b1891c78d9d77b8a2f7d4e81ae829 Mon Sep 17 00:00:00 2001
From: John Crispin <john@openwrt.org>
Date: Thu, 11 Sep 2014 12:27:26 +0000
Subject: [PATCH] include: add a meta data field for required system user:group

this is in preparation of having services run as !root with
ACL'ed access to ubus.

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 42469
---
 include/package-defaults.mk | 1 +
 include/package-dumpinfo.mk | 3 ++-
 include/package-ipkg.mk     | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 8f35c3293e6..61e495f50f2 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -53,6 +53,7 @@ define Package/Default
   HIDDEN:=
   URL:=
   VARIANT:=
+  USERID:=
 endef
 
 Build/Patch:=$(Build/Patch/Default)
diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk
index 9dc847dc1de..02415805229 100644
--- a/include/package-dumpinfo.mk
+++ b/include/package-dumpinfo.mk
@@ -41,7 +41,8 @@ $(if $(VARIANT),Build-Variant: $(VARIANT)
 Category: $(CATEGORY)
 Title: $(TITLE)
 Maintainer: $(MAINTAINER)
-Source: $(PKG_SOURCE)
+$(if $(USERID),Require-User: $(USERID)
+)Source: $(PKG_SOURCE)
 Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg))
 $(if $(KCONFIG),Kernel-Config: $(KCONFIG)
 )$(if $(BUILDONLY),Build-Only: $(BUILDONLY)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 5c83b3d58ba..1caeaa25b63 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -165,6 +165,7 @@ ifeq ($(DUMP),)
 		$(if $(PKG_LICENSE), echo "License: $(PKG_LICENSE)"; ) \
 		$(if $(PKG_LICENSE_FILES), echo "LicenseFiles: $(PKG_LICENSE_FILES)"; ) \
 		echo "Section: $(SECTION)"; \
+		$(if $(USERID),echo "Require-User: $(USERID)"; ) \
 		$(if $(filter hold,$(PKG_FLAGS)),echo "Status: unknown hold not-installed"; ) \
 		$(if $(filter essential,$(PKG_FLAGS)), echo "Essential: yes"; ) \
 		$(if $(MAINTAINER),echo "Maintainer: $(MAINTAINER)"; ) \
-- 
GitLab