summaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd.bbclass
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2014-02-06 17:37:24 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-09 09:40:41 +0000
commit4bc6982ea60929226bcd9d206b4879dea2a3157c (patch)
tree75a92e0de8521fcca84235bcfdc760e83b07c8b9 /meta/classes/useradd.bbclass
parent72288dd499d236071a5216c9a9e3b6bd66c3888a (diff)
downloadpoky-4bc6982ea60929226bcd9d206b4879dea2a3157c.tar.gz
useradd.bbclass: Add ability to select a static uid/gid automatically
[YOCTO #5436] Automatic selection of static uid/gid is needed for a dynamically generated passwd and group file to have a deterministic outcome. When a package is installed and instructs the system to add a new user or group, unless it selects a static uid/gid value, the next available uid/gid will be used. The order in which packages are installed is dynamically computed, and may change from one installation to the next. This results in a non-deterministic set of uid/gid values. Enabling this code by adding USERADDEXTENSION = "useradd-staticids", and adding a preconfigured passwd/group file will allow the continued dynamic generation of the rootfs passwd/group files, but will ensure a deterministic outcome. (Dynamic generation is desired so that users and groups that have no corresponding functionality are not present within the final system image.) The rewrite params function will override each of the fields in the useradd and groupadd calls with the values specified. Note, the password field is ignored as is the member groups field in the group file. If the field is empty, the value will not be overridden. (Note, there is no way to 'blank' a field, as this would only generally affect the 'comment' field and there really is no reason to blank it.) Enabling USERADD_ERROR_DYNAMIC will cause packages without static uid/gid to generate an error and be skipped for the purpose of building. This is used to prevent non-deterministic behavior. USERADD_UID_TABLES and USERADD_GID_TABLES may be used to specify the name of the passwd and group files. By default they are assumed to be 'files/passwd' and 'files/group'. Layers are searched in BBPATH order. (From OE-Core rev: 18c99dac52b746b88cd084eb4c2a2ef0329a6ff3) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/useradd.bbclass')
-rw-r--r--meta/classes/useradd.bbclass5
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index ad6f61a3d4..22bae97324 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -202,3 +202,8 @@ fakeroot python populate_packages_prepend () {
202 for pkg in useradd_packages.split(): 202 for pkg in useradd_packages.split():
203 update_useradd_package(pkg) 203 update_useradd_package(pkg)
204} 204}
205
206# Use the following to extend the useradd with custom functions
207USERADDEXTENSION ?= ""
208
209inherit ${USERADDEXTENSION}