summaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd.bbclass
AgeCommit message (Collapse)Author
2024-02-24useradd.bbclass: Fix order of postinst-useradd-*Piotr Łobacz
postinst-useradd-* haven't been running in order of dependency. This patch is reworked from Piotr Łobacz's patch and fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15084 https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904 basepasswd_sysroot_postinst in base-passwd can install postinst-useradd-* scripts with any order. Sometimes this means, for example a useradd postinst will attempt to run without the corresponding group postinst causing errors. This patch ensures that we first run groupadd, then useradd and then group membership. [RP: Tweaked to avoid removing previous fixes and for whitespace/style issues Also ensure the scripts are changed to execute with -e to highlight errors] Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com> Signed-off-by: Jan Górski <j.gorski@welotec.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19useradd.bbclass: Fix missing space when appending vardeps.Siong W.LIM
Signed-off-by: Siong <wslim87@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-27sysroot user management postinsts: run with /bin/sh -e to report errors when ↵Alexander Kanavin
they happen This exposes the following failure in a multilib setup, when everything up to do_package_write_rpm is in sstate, but do_package_write_rpm is not (there's a similar fail for lib64-man-db, and the failures themselves will be fixed separately in the next commit): Exception: subprocess.CalledProcessError: Command '/srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/recipe-sysroot/usr/bin/postinst-base-passwd' returned non-zero exit status 1. Subprocess output: install: cannot stat '/srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/lib64-recipe-sysroot/usr/share/base-passwd/passwd.master': No such file or directory Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-18classes/recipes: Switch to use inherit_deferRichard Purdie
Now that bitbake supports the use of inherit_defer, switch all conditional (variable based) inherits to use this instead. This leads to more a more deterministic user experience since there is no longer an immediate expansion and later changes to the variables in question (e.g. a bbappend) are accounted for. This patch tries to ensure the behaviour before/after remains as unchanged as it reasonably can, e.g. by always inherting populate_sdk_base. native and nativesdk continue to need to be inherited last, hence being used with inherit_defer in a handful of very specific cases. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-10useradd: Fix useradd do_populate_sysroot dependency bugRichard Purdie
If a task is adde which has a dependency on the do_populate_sysroot task of the recipe, it will cause it to be installed into the sysroot (similar to do_addto_recipe_sysroot). This fails since the postinst script is an overlapping file: Exception: FileExistsError: [Errno 17] File exists: 'tmp/sysroots-components/all/useraddbadtask/usr/bin/postinst-useradd-useraddbadtask' -> 'tmp/work/all-poky-linux/useraddbadtask/1.0/recipe-sysroot/usr/bin/postinst-useradd-useraddbadtask' The copy written out at do_prepare_recipe_sysroot time is just for debug so rename it, meaning there are no longer overlapping files and the installation can be successful, removing the error. [YCOTO #14961] With the bug fixed, enable the test. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08useradd: Fix issues with useradd dependenciesEilís 'pidge' Ní Fhlannagáin
If recipe A requires the useradd actions of recipe B we need to ensure that recipe B is part of the recipe A dependancy chain. In order to do that, we introduce USERADD_DEPENDS. This makes sure that the do_populate_sysroot_setscene of recipe B exists for recipe A in case of a missing TMPDIR. This requires changes made in runqueue.py by RP. This commit along with the runqueue fixes effects: Bug 13419 - recipes that add users to groups cannot rely on other recipes creating those groups (when population from sstate happens) Bug 13904 - do_prepare_recipe_sysroot: postinst-useradd-* does not run in order of dependency and sometimes fails Bug 13279 - Make sure users/groups exist for package_write_* tasks Bug 15084 - For some reason using of same user in two recipes does not work properly I've included the start of self-testing for useradd by adding tests for 13419 (which ends up testing 13904, 13279, 15084 by virtue of them all having the same root cause) Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-16useradd: Ensure preinst data is expanded correctly in pkgdataRichard Purdie
The preinst data in pkgdata will not expand out the ${XXX_PARAM} variables since they don't use a package suffix. It happens that the final expansion used for the packages is corrected by a second trip through the datastore. The first version is used for calculation of the task output hash and recent improvements in hash reuse showed this data wasn't using included in the hashes, meaning for example builds with dynamic IDs were mixing sstate with builds using static IDs. The result was a mess. Fix this by expanding the data in the preinst correctly to use the package specific _PARAM values. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30meta: Manual override fixesRichard Purdie
The automated conversion of OE-Core to use the new override sytax isn't perfect. This patches some mis-converted lines and some lines which were missed by the automation. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30Convert to new override syntaxRichard Purdie
This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-01useradd: Ensure do_populate_sysroot has dependency on useradd variablesRichard Purdie
The do_populate_sysroot task doesn't rerun if you change any of the USERADD_PARAM or GROUPADD_PARAM variables, only do_package will. If another task depends on the recipe, this means it won't see any updated changes. This patch adds in the missing vardeps ensuring the code is deterministic. [YOCTO #13232] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-31useradd: Fix build architecture corruption of sstate artefactsRichard Purdie
When mixing aarch64 and x86_64 host builds with common sstate, useradd failures were found. This was due to references to: /home/pokybuild/yocto-worker/qemuarm/build/build/tmp/sysroots-components/aarch64/pseudo-native/usr/bin/pseudo or /home/pokybuild/yocto-worker/qemuarm/build/build/tmp/sysroots-components/x86_64/pseudo-native/usr/bin/pseudo on the wrong architecture within the useradd postinst files. Instead of using COMPONENTS_DIR as the FIXME, use PSEUDO_SYSROOT which contains the arch component as well to avoid this. Add extra comments to cause the relavent sstate to be rebuilt. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-07useradd.bbclass: print a warn when useradd not foundRobert Yang
Exit quietly makes it very hard for debugging when user is not added as expected, print a warning helps a lot. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-10-06staging.bbclass: handle postinst-useradd-* fixmesMikko Ylinen
After 02457ef7f600ce954874e2d11e74b1c6daaa3bfc, PSEUDO for postinst-useradd-* scripts get to use only one PSEUDO_LOCALSTATEDIR which is set under recipes ${WORKDIR}. When the those scripts are run in a clean build environment that is built from the sstate (populate_sysroot_setscene run for postinst-useradd-* providers), pseudo fails to run because it cannot access the PSEUDO_LOCALSTATEDIR (recipe ${WORKDIR}s do not exist). This triggers a sysroot staging error. Previously, the PSEUDO_LOCALSTATEDIR setting in useradd.bbclass worked because the RSS sstate/staging logic automagically processed ${STAGING_DIR_TARGET} in postinst-useradd-* scripts to point under the sysroot being built. The fix uses the same fixme processing by adding PSEUDO_LOCALSTATEDIR variable to it. Furthermore, LOGFIFO is added to be able to use the logging fifo of the recipe that actually runs postinst-useradd-*. Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-18useradd.bbclass: Unify writing of script file in useradd_sysroot_sstate()Peter Kjellerstedt
There were two identical code blocks for writing the postinst-useradd-${PN} scripts. This combines them into one. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-18useradd: don't override pseudo environmentRoss Burton
Back in the dark days before recipe-specific-sysroots the paths being passed in this manual construction of the pseudo environment made sense, but now they're incorrect and result in pseudo writing to two different databases during a single build. The result is that pseudo doesn't follow changes to /etc/passwd in the sysroot, and warns in the logs. Remove the PSEUDO_LOCALSTATEDIR assignment and inherit the correct assignment in FAKEROOTENV. Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-10useradd: remove preinst script referring to recipe sysrootMaxin B. John
Remove recipe-specific-sysroot details from the preinst scripts generated by useradd.bbclass. This was added to match the default from bitbake.conf. Unlike the default case, the dependencies used by useradd mean that a default passwd/group file is always present. This means we don't need the native sysroot fallback. Fixes [YOCTO #11460] Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-10useradd.bbclass: Handle COMPONENTS_DIR when restoring statePeter Kjellerstedt
The export of PSEUDO in useradd_sysroot() contains references to ${COMPONENTS_DIR}. These need to be handled when restoring postinst-useradd-${PN} from the sstate cache. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-13base-passwd/useradd: Various improvements to useradd with RSSRichard Purdie
Currently there are multiple issues with useradd: * If base-passwd rebuilds, it wipes out recipe specific user/group additions to sysroots and causes errors * If recipe A adds a user and recipe B depends on A, it can't see any of the users/groups A adds. This patch changes base-passwd so it always works as a postinst script within the sysroot and copies in the master files, then runs any postinst-useradd-* scripts afterwards to add additional user/groups. The postinst-useradd-* scripts are tweaked so that if /etc/passwd doesn't exist they just exit, knowning they'll be executed later. We also add a dummy entry to the dummy passwd file from pseudo so we can avoid this too. There is a problem where if recipe A adds a user and recipe B depends on A but doesn't care about users, it may not have a dependency on the useradd/groupadd tools which would therefore not be available in B's sysroot. We therefore also tweak postinst-useradd-* scripts so that if the tools aren't present we simply don't add users. If you need the users, you add a dependency on the tools in the recipe and they'll be added. We add postinst-* to SSTATE_SCAN_FILES since almost any postinst script of this kind is going to need relocation help. We also ensure that the postinst-useradd script is written into the sstate object as the current script was only being added in a recipe local way. Thanks to Peter Kjellerstedt <pkj@axis.com> and Patrick Ohly for some pieces of this patch. [Yocto #11124] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-08useradd.bbclass: drop obsolete codeMaxin B. John
Cleanup useradd class by removing the code made obsolete by the introduction of Recipe Specific Sysroot. Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23Switch to Recipe Specific SysrootsRichard Purdie
This patch is comparatively large and invasive. It does only do one thing, switching the system to build using recipe specific sysroots and where changes could be isolated from it, that has been done. With the current single sysroot approach, its possible for software to find things which aren't in their dependencies. This leads to a determinism problem and is a growing issue in several of the market segments where OE makes sense. The way to solve this problem for OE is to have seperate sysroots for each recipe and these will only contain the dependencies for that recipe. Its worth noting that this is not task specific sysroots and that OE's dependencies do vary enormously by task. This did result in some implementation challenges. There is nothing stopping the implementation of task specific sysroots at some later point based on this work but that as deemed a bridge too far right now. Implementation details: * Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in TMPDIR/sysroot-components/PACKAGE_ARCH/PN. * WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE. * This construction is primarily done by a new do_prepare_recipe_sysroot task which runs before do_configure and consists of a call to the extend_recipe_sysroot function. * Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot dependencies. * We have to do a search/replace 'fixme' operation on the files installed into the sysroot to change hardcoded paths into the correct ones. We create a fixmepath file in the component directory which lists the files which need this operation. * Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each time a new loader is added. These are handled by adding files in bindir with the name prefixed by "postinst-" and are run in each sysroot as its created if they're present. This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them. * Since a recipe can have multiple tasks and these tasks can run against each other at the same time we have to have a lock when we perform write operations against the sysroot. We also have to maintain manifests of what we install against a task checksum of the dependency. If the checksum changes, we remove its files and then add the new ones. * The autotools logic for filtering the view of m4 files is no longer needed (and was the model for the way extend_recipe_sysroot works). * For autotools, we used to build a combined m4 macros directory which had both the native and target m4 files. We can no longer do this so we use the target sysroot as the default and add the native sysroot as an extra backup include path. If we don't do this, we'd have to build target pkg-config before we could built anything using pkg-config for example (ditto gettext). Such dependencies would be painful so we haven't required that. * PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy for each machine. The paths therefore changed, the behaviour did not. * The ccache class had to be reworked to function with rss. * The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal recipe name therefore remains a bad idea. * The logic in insane needed tweaks to deal with the new path layout, as did the debug source file extraction code in package.bbclass. * The logic in sstate.bbclass had to be rewritten since it previously only performed search and replace on extracted sstate and we now need this to happen even if the compiled path was "correct". This in theory could cause a mild performance issue but since the sysroot data was the main data that needed this and we'd have to do it there regardless with rss, I've opted just to change the way the class for everything. The built output used to build the sstate output is now retained and installed rather than deleted. * The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold up against testing. This has been rewritten too. There are some assumptions made about paths, we save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is here works but is a little hardcoded and an area for future improvement. * In order to work with eSDK we need a way to build something that looks like the old style sysroot. "bitbake build-sysroots" will construct such a sysroot based on everything in the components directory that matches the current MACHINE. It will allow transition of external tools and can built target or native variants or both. It also supports a clean task. I'd suggest not relying on this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have to have built that in a previous bitbake invocation. * pseudo is run out of its components directory. This is fine as its statically linked. * The hacks for wayland to see allarch dependencies in the multilib case are no longer needed and can be dropped. * wic needed more extensive changes to work with rss and the fixes are in a separate commit series * Various oe-selftest tweaks were needed since tests did assume the location to binaries and the combined sysroot in several cases. * Most missing dependencies this work found have been sent out as separate patches as they were found but a few tweaks are still included here. * A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my hand. That implementation can probably be neater but this is on the list of things to cleanup later at this point. In summary, the impact people will likely see after this change: * Recipes may fail with missing dependencies, particularly native tools like gettext-native, glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors * Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst * There was a separate patch series dealing with roots postinst native dependency issues. Any postinst which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS. There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean we've found all the issues. Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the task logfiles, not the console so I've intentionally left this like that for now. We can turn it down easily enough in due course. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19useradd: Add PACKAGE_WRITE_DEPS for postinstRichard Purdie
The postinstall needs shadow-native, mark the dependency Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16meta: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-10-03useradd.bbclass: Use bb.fatal() instead of raising FuncFailedUlf Magnusson
This sets a good example and avoids unnecessarily contributing to perceived complexity and cargo culting. Motivating quote below: < kergoth> the *original* intent was for the function/task to error via whatever appropriate means, bb.fatal, whatever, and funcfailed was what you'd catch if you were calling exec_func/exec_task. that is, it's what those functions raise, not what metadata functions should be raising < kergoth> it didn't end up being used that way < kergoth> but there's really never a reason to raise it yourself FuncFailed.__init__ takes a 'name' argument rather than a 'msg' argument, which also shows that the original purpose got lost. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-13useradd: do not delete users and groups during configureJoe Slater
If two recipes both create the same users and groups, the second recipe can delete items created by the first causing things like "chown" to fail for the first recipe. Signed-off-by: Joe Slater <jslater@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-08-25useradd.bblass: Simplify target overridesUlf Magnusson
The current style might be a leftover from when _class-target did not exist. Also change the assignment to SSTATECLEANFUNCS to an append, which makes more sense. useradd.bbclass is the only user of SSTATECLEANFUNCS as of writing, so it won't make any functional difference. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-28useradd.bbclass: Fix delete user/group when more than one itemMariano Lopez
Currently when a recipe adds more than one user/group, the cleansstate task will delete only the first user/group. This will solve this behavior and delete all users/groups. [YOCTO #9943] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-23useradd: Fix infinite build loopRichard Purdie
http://git.openembedded.org/openembedded-core-contrib/commit/?id=642c6cf0b6a0371de476513162bd0cefa9c438b3 introduces a problem if the USERADD_PARAM variable has trailing whitespace as the code infinitely loops causing build hangs. Add a similar sed expression to $remaining to avoid this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-19useradd.bbclass: Strip trailing ';' in cmd paramsKhem Raj
When there are more than 1 packages in a recipe requiring useradd services, they are concatnated and a ';' is inserted just after each of the users being added by the packages. A situation arises in cases where this is controlled by PACKAGECONFIG then we add a ';' separator in the USERADD_PARAM value itself for each packagecofig since we do not know which one will be picked, we end up in situation where the final string returned from get_all_cmd_params() appears to be a; ; b; c; and then the logic which uses these cmds triggers with ';' as separator but in this case it will fail after executing useradd 'a' because the next cmd it will call will be just a whitespace This is highlighted by the systemd patch to add more users as needed by systemd 229 components. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-19useradd: use bindir_native for pseudo PATHMartin Jansa
* useradd/userdel functions will fail for recipes which override their target prefix (e.g. to /opt/foo), because it will try to use pseudo from native-sysroot/opt/foo/bin/pseudo Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-06useradd.bbclass: remove user/group created by the package in clean* taskMaxin B. John
At present, if a recipe is built which creates users/groups via useradd.bbclass, those users/groups are not removed from sysroot when the recipe/package is cleaned using clean/cleansstate/cleanall or when a recipe is rebuild and 'unstaged' from the the sysroot. The "userdel_sysroot_sstate()" provides that functionality. [YOCTO #9262] Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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>