From eefe055d23e3204783f480182ba620e0eb8ec39c Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Mon, 26 Apr 2021 15:45:37 +0100
Subject: [PATCH] homeassistant-useradd.inc: Provide an inc file for the HA
 useradd configuration

This inc file is useful so multiple recipes can synchronise on the same
user configuration. For example, a recipe bringing a custom Home
Assistant configuration would use this to set the proper user ownership
of the configuration file.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../homeassistant/homeassistant-useradd.inc      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 meta-ohos-blueprints/recipes-homeassistant/homeassistant/homeassistant-useradd.inc

diff --git a/meta-ohos-blueprints/recipes-homeassistant/homeassistant/homeassistant-useradd.inc b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/homeassistant-useradd.inc
new file mode 100644
index 00000000..1c9dc948
--- /dev/null
+++ b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/homeassistant-useradd.inc
@@ -0,0 +1,16 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+inherit useradd
+
+HOMEASSISTANT_USER ?= "homeassistant"
+HOMEASSISTANT_USER[doc] = "User the home-assistent service runs as."
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system homeassistant"
+USERADD_PARAM_${PN} = "\
+    --system --no-create-home --shell /bin/false \
+    --home ${HOMEASSISTANT_CONFIG_DIR} \
+    --groups homeassistant,dialout --gid homeassistant \
+    ${HOMEASSISTANT_USER}"
-- 
GitLab