summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-skeleton/recipes-skeleton/useradd/useradd-dep.bb39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta-skeleton/recipes-skeleton/useradd/useradd-dep.bb b/meta-skeleton/recipes-skeleton/useradd/useradd-dep.bb
new file mode 100644
index 0000000000..b5cbc5d170
--- /dev/null
+++ b/meta-skeleton/recipes-skeleton/useradd/useradd-dep.bb
@@ -0,0 +1,39 @@
+SUMMARY = "Example recipe for using inherit useradd and reusing group from useradd-example"
+DESCRIPTION = "This recipe serves as an example for using features from useradd.bbclass"
+SECTION = "examples"
+PR = "r1"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+S = "${WORKDIR}"
+
+EXCLUDE_FROM_WORLD = "1"
+
+inherit useradd
+
+# https://www.openembedded.org/pipermail/bitbake-devel/2018-March/009256.html
+# says that RDEPENDS_${PN} should be enough, but in my testing we need
+# built time dependency as well for groups to exist early enough
+DEPENDS = "useradd-example"
+
+RDEPENDS_${PN} = "useradd-example"
+RDEPENDS_${PN}-user3 = "useradd-example-user3"
+
+# You must set USERADD_PACKAGES when you inherit useradd. This
+# lists which output packages will include the user/group
+# creation code.
+USERADD_PACKAGES = "${PN} ${PN}-user3"
+
+# USERADD_PARAM specifies command line options to pass to the
+# useradd command. Multiple users can be created by separating
+# the commands with a semicolon. Here we'll create two users,
+# user1 and user2:
+USERADD_PARAM_${PN} = "-u 2200 -d /home/user1dep -r -s /bin/bash -G group1 user1dep; -u 2201 -d /home/user2dep -r -s /bin/bash -G group2 user2dep"
+
+# user3 will be managed in the useradd-example-user3 pacakge:
+# As an example, we use the -P option to set clear text password for user3
+USERADD_PARAM_${PN}-user3 = "-u 2202 -d /home/user3dep -r -s /bin/bash -P 'user3' -G group3 user3dep"
+
+# Prevents do_package failures with:
+# debugsources.list: No such file or directory:
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"