extrauser 和 useradd 之间的确切区别是什么

What is the exact difference between extrauser and useradd

在一个配方中我可以看到以下内容,但它没有创建任何额外的用户或组,我在检查 rpm 文件时确认了这一点。

inherit extrausers
EXTRA_USERS_PARAMS = "\
        useradd -p '' example; \
        groupadd example; \
        "

所以我在为我创建用户和组的配方中添加了以下内容。

inherit useradd
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system example"
USERADD_PARAM_${PN} = "--system -M -d /var/lib/example -s /bin/false -g example example"

yocto 中 useradd 和 extrausers 之间的确切区别是什么。为什么extrausers不能创建用户和组。

extrausers 在图像级别添加 user/group 并且不能绑定到特定的配方,这就是 useradd 的作用class,可用于食谱。

阅读笔记here

Note

The user and group operations added using the extrausers class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a whole. Use the useradd class to add user and group configuration to a specific recipe.

这里是 useradd 的注释:

The useradd* classes support the addition of users or groups for usage by the package on the target. For example, if you have packages that contain system services that should be run under their own user or group, you can use these classes to enable creation of the user or group.