summaryrefslogtreecommitdiffstats
path: root/meta/classes/extrausers.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
commit8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch)
treeefdc32587159d0050a69009bdf2330a531727d95 /meta/classes/extrausers.bbclass
parentd412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff)
downloadpoky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz
The poky repository master branch is no longer being updated.
You can either: a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs b) use the new bitbake-setup You can find information about either approach in our documentation: https://docs.yoctoproject.org/ Note that "poky" the distro setting is still available in meta-yocto as before and we continue to use and maintain that. Long live Poky! Some further information on the background of this change can be found in: https://lists.openembedded.org/g/openembedded-architecture/message/2179 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/extrausers.bbclass')
-rw-r--r--meta/classes/extrausers.bbclass77
1 files changed, 0 insertions, 77 deletions
diff --git a/meta/classes/extrausers.bbclass b/meta/classes/extrausers.bbclass
deleted file mode 100644
index c825c06df9..0000000000
--- a/meta/classes/extrausers.bbclass
+++ /dev/null
@@ -1,77 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# This bbclass is used for image level user/group configuration.
8# Inherit this class if you want to make EXTRA_USERS_PARAMS effective.
9
10# Below is an example showing how to use this functionality.
11# IMAGE_CLASSES += "extrausers"
12# EXTRA_USERS_PARAMS = "\
13# useradd -p '' tester; \
14# groupadd developers; \
15# userdel nobody; \
16# groupdel -g video; \
17# groupmod -g 1020 developers; \
18# usermod -s /bin/sh tester; \
19# "
20
21inherit useradd_base
22
23PACKAGE_INSTALL:append = " ${@['', 'base-passwd shadow'][bool(d.getVar('EXTRA_USERS_PARAMS'))]}"
24
25# Image level user / group settings
26ROOTFS_POSTPROCESS_COMMAND:append = " set_user_group"
27
28# Image level user / group settings
29set_user_group () {
30 user_group_settings="${EXTRA_USERS_PARAMS}"
31 export PSEUDO="${FAKEROOTENV} ${STAGING_DIR_NATIVE}${bindir}/pseudo"
32 setting=`echo $user_group_settings | cut -d ';' -f1`
33 remaining=`echo $user_group_settings | cut -d ';' -f2-`
34 while test "x$setting" != "x"; do
35 cmd=`echo $setting | cut -d ' ' -f1`
36 opts=`echo $setting | cut -d ' ' -f2-`
37 # Different from useradd.bbclass, there's no file locking issue here, as
38 # this setting is actually a serial process. So we only retry once.
39 case $cmd in
40 useradd)
41 perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
42 ;;
43 groupadd)
44 perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
45 ;;
46 userdel)
47 perform_userdel "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
48 ;;
49 groupdel)
50 perform_groupdel "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
51 ;;
52 usermod)
53 perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
54 ;;
55 passwd-expire)
56 perform_passwd_expire "${IMAGE_ROOTFS}" "$opts"
57 ;;
58 groupmod)
59 perform_groupmod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} $opts"
60 ;;
61 *)
62 bbfatal "Invalid command in EXTRA_USERS_PARAMS: $cmd"
63 ;;
64 esac
65 # Avoid infinite loop if the last parameter doesn't end with ';'
66 if [ "$setting" = "$remaining" ]; then
67 break
68 fi
69 # iterate to the next setting
70 setting=`echo $remaining | cut -d ';' -f1`
71 remaining=`echo $remaining | cut -d ';' -f2-`
72 done
73}
74
75USERADDEXTENSION ?= ""
76
77inherit ${USERADDEXTENSION}