From c9af7ceb3b7be48cc1b1542474c894792b03289f Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Mon, 11 Jul 2022 15:29:19 +0200
Subject: [PATCH] shadow: Enable subid support

shadow utils are used when creating users at image creation time. The
useradd/usermod tools will only try to add a default configuration for
subid files if they exist. subid files are needed for podman rootless
support.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../recipes-extended/shadow/shadow_%.bbappend            | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta-oniro-core/recipes-extended/shadow/shadow_%.bbappend b/meta-oniro-core/recipes-extended/shadow/shadow_%.bbappend
index 43d22ca9..2909fbc3 100644
--- a/meta-oniro-core/recipes-extended/shadow/shadow_%.bbappend
+++ b/meta-oniro-core/recipes-extended/shadow/shadow_%.bbappend
@@ -9,5 +9,12 @@
 # Removing -Werror=format-nonliteral here allows us to use
 # -Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
 # while keeping shadow building.
-
 TARGET_CFLAGS:remove = "-Werror=format-nonliteral"
+
+do_install:append () {
+	# usermod requires the subuid/subgid files to be in place before being
+	# able to use the -v/-V flags otherwise it fails:
+	# usermod: /etc/subuid does not exist, you cannot use the flags -v or -V
+	touch ${D}${sysconfdir}/subuid
+	touch ${D}${sysconfdir}/subgid
+}
-- 
GitLab