Add recipe to create osmocom user and group

This adds osmocom system user and corresponding group which
will be used by osmo-* services later on.

Fixes: OS#5684
Change-Id: Iab40dded99696679d1be7ff460f515e3b0014d8f
This commit is contained in:
Max 2022-09-24 09:26:25 +07:00
parent 71d4865653
commit 9beb3f5256
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
SUMMARY = "Add osmocom user and group"
DESCRIPTION = "This recipe adds osmocom user and group which will be used by osmo-* services instead of root"
SECTION = "FIXME"
PR = "r1"
SRC_URI = "file://file1 file://file4"
S = "${WORKDIR}"
PACKAGES =+ "${PN}"
EXCLUDE_FROM_WORLD = "1"
inherit useradd
# You must set USERADD_PACKAGES when you inherit useradd. This
# lists which output packages will include the user/group
# creation code.
USERADD_PACKAGES = "${PN}"
# You must also set USERADD_PARAM and/or GROUPADD_PARAM when
# you inherit useradd.
# USERADD_PARAM specifies command line options to pass to the
# useradd command. Multiple users can be created by separating
# the commands with a semicolon.
USERADD_PARAM:${PN} = "--system --gid osmocom --home-dir /var/lib/osmocom --shell /sbin/nologin --comment "Open Source Mobile Communications" osmocom"
# GROUPADD_PARAM works the same way, which you set to the options
# you'd normally pass to the groupadd command. This will create group osmocom:
GROUPADD_PARAM:${PN} = "--system osmocom"
do_install () {
install -d -m 755 ${D}${datadir}/osmocom
install -p -m 644 file1 ${D}${datadir}/osmocom/
# The new users and groups are created before the do_install
# step, so you are now free to make use of them:
chown -R osmocom ${D}${datadir}/osmocom
chgrp -R osmocom ${D}${datadir}/osmocom
}
FILES:${PN} = "${datadir}/osmocom/*"
# Prevents do_package failures with:
# debugsources.list: No such file or directory:
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"