aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd.bbclass
AgeCommit message (Collapse)Author
2016-03-20useradd_base.bbclass: replace retry logic with flockKai Kang
When perform useradd during populate sysroot, it locks files passwd.lock and group.lock at same time. And then it meets a dead lock issue randomly. Use flock to reslove it by using an universal lock directory for all the user and group related operations. [YOCTO #9022] Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-02-11classes/useradd: handle whitespace only USERADD/GROUPADD/GROUPMEMSMaciej Borzecki
Useradd attempts to add users/groups even when {USERADD,GROUPADD,GROUPMEMS}_PARAM is whitespace only. This scenario is possible when variables and modified using one of +=, =+ operator, yet the content being added is conditional (i.e. may depend on PACKAGECONFIG flags). Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-16classes/useradd: don't read bbnote/bbwarn/bbfatal valuesPaul Eggleton
Since these functions now log through BitBake's message logging system we must have standalone implementations here. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-06-23meta: Add explict getVar param for (non) expansionRichard Purdie
Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15useradd.bbclass: Remove base-passwd dependencyLeonardo Sandoval
shadow-sysroot (another useradd dependency) recipe already includes base-passwd dependency, so removing it from useradd class. This fixes the compilation issue observed when a recipe depends on another where the latter inherits from useradd as in the following scenario: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7724#c0 [Yocto #7724] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-02-17useradd.bbclass: avoid do_rootfs error for debian package backendChen Qi
If /etc/login.defs is treated as a configuration file, then we would meet errors at do_rootfs time telling us that useradd/groupadd cannot execute correctly. This is because the dpkg handles config file specially, the login.defs is temporarily renamed as login.defs.dpkg-new. How ubuntu deals the user/group adding problem? They do it at postinst of the package. And, the postinst script of a package would possibly do `chown' of its files or directories. The above strategy is not suitable for OE. Because we do chown in do_install and add user/group in preinst scripts of the packages. That's why we need this patch so that do_rootfs don't fail. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-11-25useradd.bbclass: set PSEUDO_PASSWD consistent with root directoryPeter A. Bigot
When installing into a sysroot this class examines $D/etc/passwd for content, then invokes useradd to make changes. Under pseudo useradd attempts to look up user information in directories specified by $PSEUDO_PASSWD. For opkg multilib installs $D is not always the same as $IMAGE_ROOT, and the user might already be in the IMAGE_ROOT files, causing a failure during rootfs population. Fix this by ensuring the files pseudo looks at when doing useradd stuff are the same ones that useradd.bbclass will be manipulating. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2014-08-29useradd: Add setscene dep on pseudo-nativeJate Sujjavanich
A recipe will sometimes be rebuilt unnecessarily if it adds users via useradd and the pseudo-native task has not been populated. This patch adds the correct dependency. Signed-off-by: Jate Sujjavanich <jatedev@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-06update-rc.d/useradd: Add additional dependeciesSaul Wold
These dependcies are needed to ensure that thier packages are created correctly since these classes have runtime dependiences in their packages but they are not actually created yet at rootfs time. [YOCTO #6072] Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-20useradd{-static}: Ignore useradds on nativesdkMark Hatle
The code was supposed to ignore both native and nativesdk operations when using the useradd and useradd-static code. However, somewhere along the way the code was dropped. This didn't cause any issues until someone enabled the enforcing mode in the new useradd-static and various nativesdk packages started to fail. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-12meta/recipes: Remove virtclass referencesRichard Purdie
The virtclass overrides will go away at some point (apart from the multilib one). Change them all to class-xxx instead since people enjoy copy and pasting them. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-08useradd.bbclass: Add ability to select a static uid/gid automaticallyMark Hatle
[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. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-08useradd.bbclass: Fix build time install issuesMark Hatle
When the system attempts to populate the sysroot's passwd/group files, it does so in a single block. However, with the way it was previously implemented, the system would always run through the code necessary to populate the sysroot, even in the case of target packages. This had the side effect that a cross-installed filesystem may not match a target installed filesystem. The code was slightly reorganized to ensure that the cross/target installed pre-install script behavior is the same. It also moves the block that configures the sysroot parameters to the sysroot specific section of the code. Also some minor validation was occuring even on nativesdk packages. Nativesdk packages should be skipped when processing useradd ops. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-18useradd.bbclass: add dependency on base-filesRoss Burton
Packages that use useradd.bbclass should have a dependency on base-files so that the /etc/skel directory is populated. Without this dependency base-files may or may not be installed when the postinst runs, and the skel content may or may not be copied. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06useradd: Handle users from a package being used in othersThomas Fitzsimmons
If there is a package A (TUNE_PKGARCH) which is depended upon by B which is MACHINE_ARCH and you build B for machine X, then Y, the user isn't present in the sysroot for machine Y since the useradd code is never triggered. The change ensures the code does get triggered and the user is present. [YOCTO 4739] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-20useradd.bbclass: add missing functions to preinstChen Qi
The preinst scripts are calling bbnote, bbwarn and bbfatal functions, but these functions are not written to the preinst scripts. This patch writes these missing functions to the preinst scripts to avoid the 'not found' errors. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-26useradd.bbclass: fix traceback when inheriting useradd but not setting ↵Ionut Radu
USERADD_PARAM or GROUPADD_PARAM Replaced bb.build.FuncFailed with bb.fatal [YOCTO #4486] Signed-off-by: Ionut Radu <ionutx.radu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-22useradd.bbclass: add a new base class and code refactorChen Qi
Add a new base class, useradd_base.bbclass, which is mainly a collection of basic functions for user/group settings. The useradd_base.bbclass is intended to be inherited by useradd.bbclass and the extrausers.bbclass to avoid code cuplication. [YOCTO #4074] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-06-27useradd.bbclass: Add members to a groupMikhail Durnev
useradd.bbclass supports adding new users and new groups. But it does not support adding existing users to existing groups. There is a need of adding users to some groups (e.g. audio). The class was extended to call groupmems utility with arguments passed via GROUPMEMS_PARAM. Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-06-07base/useradd/sstate: Ensure do_package setscene has correct fakeroot ↵Richard Purdie
dependencies The do_package_setscene task needs to depend on fakeroot in order to correctly install its files. We can whitelist the dependency in the sstate handling code for some performance improvements since we only need this if we're installing the package from sstate. Also use an append operator in base.bbclass for clarity. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09useradd: Use modern join syntaxRichard Purdie
string.join() is deprecated syntax and doesn't work under python3 so use the modern sytax instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09classes: Use modern exception raising syntaxRichard Purdie
Modern expection rasing syntax is function call format, convert to this to keep python 3 happy and model correct coding style in the core. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-02classes: replace virtclass-native(sdk) with class-native(sdk)Robert Yang
The overrides virtclass-native and virtclass-nativesdk are deprecated, which should be replaced by class-native and class-nativesdk. [YOCTO #3297] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-07-19Convert tab indentation in python functions into four-spaceRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-17useradd.bbclass: Fix for multilib buildsRichard Purdie
The class adds a setscene dependency on base-passwd as well as adds this to DEPENDS. The DEPENDS version will be auso-converted to include MLPREFIX whilst the setscene dependency will not. This result in errors about non-existent tasks. This patch ensures MLPREFIX is added when it is needed and fixes various build failures. Whether we should have two base-passwd recipes in a multilib system is a question which would need to be addressed by future changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-16Multilib: Fix RDEPENDS in libc-package.bbclass, useradd.bbclass...Zhai Edwin
MLPREFIX is needed in RDEPENDS for multilib build Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-23useradd.bbclass: retry useradd/groupadd commands to avoid lock race issuesScott Garman
A race condition can occur when adding users and groups to the passwd and group files, causing errors like the following: ERROR: Function 'useradd_sysroot' failed Tried to access "/etc/group" but this was locked. This fix will cause the useradd code to retry the useradd and groupadd commands up to 10 times (with a 1s sleep in between attempts) before failing. This fixes [YOCTO #1794] Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-08shadow-sysroot: Fix for multilibZhai Edwin
Fix following error in multilib build: "ERROR: Task do_package_setscene depends upon nonexistant task poky/meta/recipes-extended/shadow/shadow-sysroot_4.1.4.3.bb:do_populate_sysroot_setscene" >From richard.purdie@linuxfoundation.org Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-24useradd.bbclass: override USERADDSETSCENEDEPS to empty when building cross ↵Otavio Salvador
packages Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-10useradd.bbclass: skip processing on virtclass-cross extended packagesOtavio Salvador
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2012-01-27useradd.bbclass: Fix missing quoteRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27useradd: Ensure dependencies are only added for target recipes, not native ↵Richard Purdie
or nativesdk Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27useradd.bbclass: Add explict setscene dependencies to ensure correct ↵Richard Purdie
ordering of setscene tasks Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27useradd.bbclass: Ensure pseudo can load in the pseudo unloaded caseRichard Purdie
In the do_populate_sysroot_setscene case, pseudo has been unloaded and we need to reload it. This code change ensures all the pseudo options are specified so pseudo loads correctly. It also improves some of the comments so all the different contexts are listed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27useradd.bbclass: Execute user addition code before do_package_setscene, not ↵Richard Purdie
after do_populate_sysroot_setscene The user addition needs to happen before the do_package files are extracted by do_package_setscene since those are the ones we need to preserve the file ownership information for. This patch ensures this happens. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-21useradd: Ensure -native recipes don't depend on target recipesRichard Purdie
Without this change, dbus-native can end up depending upon base-passwd for example. This change mirrors the existing nativesdk code. Based on a patch from Henning Heinold <heinold@inf.fu-berlin.de> but with some additions from me. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10Convert to use direct access to the data store (instead of bb.data.*Var*())Richard Purdie
This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10useradd: Add missing DEPEND on shadowRichard Purdie
Without this rootfs generation fails as an RDEPENDS is added but the package might not have bneen built. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10useradd.bbclass: do not modify -nativesdk packagesScott Garman
Exclude the addition of user/group code and RDEPENDS changes for -nativesdk packages. Signed-off-by: Scott Garman <scott.a.garman@intel.com>
2011-11-10useradd.bbclass: only modify packages in USERADD_PACKAGESScott Garman
Previously we injected the user/group preinstall script into all output packages. This fixes that so that only packages listed in USERADD_PACKAGES get modified. It also removes the USERADDPN variable, which is no longer needed. Signed-off-by: Scott Garman <scott.a.garman@intel.com>
2011-11-08useradd.bbclass: handle nativesdk caseEric Bénard
* without this patch, building dbus-nativesdk leads to a missing dependency on 'base-passwd-nativesdk' This was added by commit 46e6c3fa8034b12d178d605f3f5d7efe69671a13 * this patch handle the nativesdk case in the class useradd * close bug 1702 http://bugzilla.pokylinux.org/show_bug.cgi?id=1702 * v2 from Scott Garman with Richard Purdie's tricks Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-08useradd.bbclass: fix how RDEPENDS is setupScott Garman
Fix bug where only packages named PN included base-passwd in RDEPENDS. This fixes [YOCTO #1727] Signed-off-by: Scott Garman <scott.a.garman@intel.com>
2011-10-24useradd.bbclass: check if a group already exists manuallyOtavio Salvador
The use of groupadd -f makes much more difficult to figure when a group is not add. This was the case of the class not working for our usage and this being caused by the lack of '/etc/group' file but unnoticed as groupadd wasn't failing according. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2011-09-07useradd.bbclass: use correct value for $D in postinst functionsPhil Blundell
This corrects the location of the password file used during package installation. See http://lists.linuxtogo.org/pipermail/openembedded-core/2011-September/009183.html and subsequent discussion. Signed-off-by: Phil Blundell <philb@gnu.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-02useradd.bbclass: remove hardcoded reference to /usr/binPhil Blundell
Otherwise the class doesn't work if ${bindir} is set to a different value; likewise for /var vs ${localstatedir}. Signed-off-by: Phil Blundell <philb@gnu.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-07-01useradd.bbclass: new class for managing user/group permissionsScott Garman
This class is to be used by recipes that need to set up specific user/group accounts and set custom file/directory permissions. Signed-off-by: Scott Garman <scott.a.garman@intel.com>