diff options
| author | unitexe <unitexe70@gmail.com> | 2026-02-23 08:25:47 -0600 |
|---|---|---|
| committer | unitexe <unitexe70@gmail.com> | 2026-02-25 10:50:17 -0600 |
| commit | 4ae980f0e69f7ca770798688535308a06a8ccf74 (patch) | |
| tree | d636b1e73bf82f0f25528c0d1c9887bd31b5506b /meta-unit-virtualization/recipes-users/useradd | |
| parent | a3bfb4cb06e750cfd9fbc5592b860f49b0a5d321 (diff) | |
Introduce meta-unit-virtualization
Primary motivation for this is removing observability containers from beaglebone black because of RAM limitations. Images can now include the observability containers by adding `observability` to `IMAGE_FEATURES`.
Diffstat (limited to 'meta-unit-virtualization/recipes-users/useradd')
| -rw-r--r-- | meta-unit-virtualization/recipes-users/useradd/add-user-svc.bb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta-unit-virtualization/recipes-users/useradd/add-user-svc.bb b/meta-unit-virtualization/recipes-users/useradd/add-user-svc.bb new file mode 100644 index 0000000..dbbc0c5 --- /dev/null +++ b/meta-unit-virtualization/recipes-users/useradd/add-user-svc.bb @@ -0,0 +1,43 @@ +SUMMARY = "Add service user" +LICENSE = "MIT" + +EXCLUDE_FROM_WORLD = "1" + +inherit useradd +inherit extrausers +inherit enable-linger +inherit set-xdg-env + +RDEPENDS:${PN}:append = " base-passwd" +RDEPENDS:${PN}:append = " busybox" +RDEPENDS:${PN}:append = " shadow" +RDEPENDS:${PN}:append = " systemd" + +USERADD_PACKAGES = "${PN}" + +USER_TO_ADD_NAME ?= "svc" +USER_TO_ADD_UID ?= "50556" +USER_TO_ADD_PASSWORD_HASHED ?= "\$6\$1TQs7iLskyTyCjoL\$xhngcFWaPRsoaZCwLSsYXUrRcVdR19zV2vBEzrzSEVu8zbqDlfKu4HLwzsZfiqJCiWqiu9qirD4Ym12CMf7D7." +COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO ?= "systemd-journal" + +USERADD_PARAM:${PN} = "-u ${USER_TO_ADD_UID} -d /home/${USER_TO_ADD_NAME} -s ${base_bindir}/sh -G ${COMMA_SEPARATED_LIST_OF_GROUPS_TO_ADD_USER_TO} -p '${USER_TO_ADD_PASSWORD_HASHED}' ${USER_TO_ADD_NAME}" + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +do_install() { + # Note: Use of .profile here assumes busybox shell. + install -D -m 0644 /dev/null ${D}/home/${USER_TO_ADD_NAME}/.profile + + # User is not part of sudo group and therefore doesn't + # have sbin in path, add it for access to common commands. + cat > ${D}/home/${USER_TO_ADD_NAME}/.profile << 'EOF' +export PATH="${sbindir}:/sbin:$PATH" +EOF +} + +# Prior to useradd being performed on the sysroot a couple things must happen: +# 1. Need the systemd recipe to create the systemd-journal group +# 2. Need busybox shell present +do_prepare_recipe_sysroot[depends] += "systemd:do_populate_sysroot busybox:do_populate_sysroot" + +FILES:${PN}:append = " /home/${USER_TO_ADD_NAME}/.profile" |
