Commit Graph

33 Commits

Author SHA1 Message Date
Ross Burton 6d0a79526b useradd.bbclass: add dependency on base-files
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.

(From OE-Core master rev: 556368ba8a1f933a86b69be024bd0711d4bfe0a3)

(From OE-Core rev: c5756a0041837d030429a8a1ecd30cd5f7082137)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-09 11:04:15 +00:00
Thomas Fitzsimmons f24dda3de9 useradd: Handle users from a package being used in others
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]

(From OE-Core rev: 5871337da49f8cd1eaf53f7cd0aacc026dc7bcdb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06 23:04:48 +01:00
Chen Qi 1cf5a36aa9 useradd.bbclass: add missing functions to preinst
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.

(From OE-Core rev: ed45f00ef76d189611cda2cb922fa7eb8f86d9cc)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-20 15:31:25 +01:00
Ionut Radu 3e3ab8e02d useradd.bbclass: fix traceback when inheriting useradd but not setting USERADD_PARAM or GROUPADD_PARAM
Replaced bb.build.FuncFailed with bb.fatal

[YOCTO #4486]

(From OE-Core rev: be6d0f398404e4566d4fac145c745899909117f1)

Signed-off-by: Ionut Radu <ionutx.radu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-29 13:09:01 +01:00
Chen Qi 50d2548f74 useradd.bbclass: add a new base class and code refactor
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]

(From OE-Core rev: 2a57bb7e9a7e154578aa7cb9aeebdf398a54ec00)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-24 11:35:35 +01:00
Mikhail Durnev c62b1a3338 useradd.bbclass: Add members to a group
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.

(From OE-Core rev: 6b3bd34bf8c5e511bccfbb64bdd1236e1e7576e3)

Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-28 09:14:07 +01:00
Richard Purdie 7bf5c38e0f base/useradd/sstate: Ensure do_package setscene has correct fakeroot 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.

(From OE-Core rev: 0810ea2a72bdea67a3d8002c4e12fb20f45cf1d5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-07 17:52:08 +01:00
Richard Purdie 4a9daa971c useradd: Use modern join syntax
string.join() is deprecated syntax and doesn't work under python3
so use the modern sytax instead.

(From OE-Core rev: 402d652edf79bcfe1eaf1a3b55ad1177d1e3ee85)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 22:28:03 +01:00
Richard Purdie db8217f6b8 classes: Use modern exception raising syntax
Modern expection rasing syntax is function call format, convert to this
to keep python 3 happy and model correct coding style in the core.

(From OE-Core rev: f4b382754603d3f1caa13824bcc8d06b568bbc59)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:50 +01:00
Robert Yang 51c7ad682f classes: replace virtclass-native(sdk) with class-native(sdk)
The overrides virtclass-native and virtclass-nativesdk are deprecated,
which should be replaced by class-native and class-nativesdk.

[YOCTO #3297]

(From OE-Core rev: 9fbeab63315fef0dbcc91c5e7051665764758a6e)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-02 16:18:27 +00:00
Richard Purdie bfd279de32 Convert tab indentation in python functions into four-space
(From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19 10:24:50 +01:00
Richard Purdie 219a855f99 useradd.bbclass: Fix for multilib builds
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.

(From OE-Core rev: 22dff7f36e985f9f7275b47e874147bc7bdc9473)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-17 10:56:26 +01:00
Zhai Edwin d1eba59ffd Multilib: Fix RDEPENDS in libc-package.bbclass, useradd.bbclass...
MLPREFIX is needed in RDEPENDS for multilib build

(From OE-Core rev: 380efadd5640e5b57e710549b1ae761d0d3b3792)

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-16 12:52:10 +01:00
Scott Garman c9537c52f4 useradd.bbclass: retry useradd/groupadd commands to avoid lock race issues
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]

(From OE-Core rev: 68c589f1b5ee36f0aff151b728447ffdae14622c)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-23 12:13:08 +00:00
Zhai Edwin b417983f75 shadow-sysroot: Fix for multilib
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

(From OE-Core rev: 5de2c22fb42c12783abc090a81f10db9eb39732f)

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-08 11:55:37 -08:00
Otavio Salvador b6bd0f8a32 useradd.bbclass: override USERADDSETSCENEDEPS to empty when building cross packages
(From OE-Core rev: 5650eb44ea28c87f2f87ea3c5a557b9f08d58775)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-24 23:25:52 +00:00
Otavio Salvador af85900ba7 useradd.bbclass: skip processing on virtclass-cross extended packages
(From OE-Core rev: 4308acbbd43e6b8b37123d95df6675233007dae4)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-10 14:38:40 +00:00
Richard Purdie 636d7e308f useradd.bbclass: Fix missing quote
(From OE-Core rev: d7b13cd42ab8d5f44f97e119b73ec2e363677d26)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27 23:57:46 +00:00
Richard Purdie b719d7e10b useradd: Ensure dependencies are only added for target recipes, not native or nativesdk
(From OE-Core rev: 63d006b2d3fc2223c74f81b91f70f5c841108c80)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27 16:59:56 +00:00
Richard Purdie 75fcfde061 useradd.bbclass: Add explict setscene dependencies to ensure correct ordering of setscene tasks
(From OE-Core rev: ffc7bbcf0011de3f1f6e8d95f1de0b8f7164fa51)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27 09:42:48 +00:00
Richard Purdie 3b47c5310a useradd.bbclass: Ensure pseudo can load in the pseudo unloaded case
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.

(From OE-Core rev: 76345cd61c9523ce6755ef8e923dec37800b7a98)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27 09:40:07 +00:00
Richard Purdie 0a3a15c8dd useradd.bbclass: Execute user addition code before do_package_setscene, not 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.

(From OE-Core rev: 34282c1b996ef008384af456735692d66ddabc13)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-27 09:40:07 +00:00
Richard Purdie 0b640a419c useradd: Ensure -native recipes don't depend on target recipes
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.

(From OE-Core rev: eba81d1c606ec29ffb793c1cb3cfed9562d552bc)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-21 16:48:51 +00:00
Richard Purdie c8dee9b92d Convert to use direct access to the data store (instead of bb.data.*Var*())
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 *`

(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:51:19 +00:00
Richard Purdie 605d011641 useradd: Add missing DEPEND on shadow
Without this rootfs generation fails as an RDEPENDS is added
but the package might not have bneen built.

(From OE-Core rev: bfe70c6446e6686f826f01040ba74c7d7d28bf42)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:37:13 +00:00
Scott Garman 3b93447e35 useradd.bbclass: do not modify -nativesdk packages
Exclude the addition of user/group code and RDEPENDS changes for
-nativesdk packages.

(From OE-Core rev: 2f057dd905ccb497890ce73ac4e4c256edcf0351)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:37:12 +00:00
Scott Garman 67a2c35530 useradd.bbclass: only modify packages in USERADD_PACKAGES
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.

(From OE-Core rev: 2f73466eb5018040a123ccb0e2af8c519525f958)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:37:12 +00:00
Eric Bénard d5175bb3ed useradd.bbclass: handle nativesdk case
* 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

(From OE-Core rev: 140a3507fb5c14cd9bcebe4304f491aa1c5c47a2)

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-08 16:22:48 +00:00
Scott Garman 27d70f9655 useradd.bbclass: fix how RDEPENDS is setup
Fix bug where only packages named PN included base-passwd in
RDEPENDS.

This fixes [YOCTO #1727]

(From OE-Core rev: 2c55d51afd71d708a54afc8377e10c4f80f810e3)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-08 14:13:24 +00:00
Otavio Salvador 5ea680a7f4 useradd.bbclass: check if a group already exists manually
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.

(From OE-Core rev: 82933a1ff921fd0836f03e6f379fd8536cdc0a30)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-10-24 17:27:15 +01:00
Phil Blundell 00b47701f4 useradd.bbclass: use correct value for $D in postinst functions
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.

(From OE-Core rev: 848bb277769af5b094031aeb54d287c158256724)

Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-07 23:44:29 +01:00
Phil Blundell 050e43a57f useradd.bbclass: remove hardcoded reference to /usr/bin
Otherwise the class doesn't work if ${bindir} is set to a different value;
likewise for /var vs ${localstatedir}.

(From OE-Core rev: 21371df16917cd82642b39763793783d61ee5516)

Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-02 18:36:20 +01:00
Scott Garman 14be7dbb15 useradd.bbclass: new class for managing user/group permissions
This class is to be used by recipes that need to set up specific
user/group accounts and set custom file/directory permissions.

(From OE-Core rev: a82885db00956734922291d8a17eb135461204fa)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-07-01 17:17:34 +01:00