summaryrefslogtreecommitdiffstats
path: root/meta/classes/useradd.bbclass
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2015-02-17 10:08:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-17 22:35:03 +0000
commit9973ce1703e28242e58068ca2f764f3980a57922 (patch)
treee71df79f67717cf1588cbc74454c3273e708f04b /meta/classes/useradd.bbclass
parent3d7c798dff4afa51b8e2e543ac7f2c5e27275750 (diff)
downloadpoky-9973ce1703e28242e58068ca2f764f3980a57922.tar.gz
useradd.bbclass: avoid do_rootfs error for debian package backend
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. (From OE-Core rev: d98e5ec575f542b3afaabd96b07ae9a21e1c22f4) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/useradd.bbclass')
-rw-r--r--meta/classes/useradd.bbclass10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 0b9a843b24..e443f845f7 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -24,6 +24,16 @@ if test "x$D" != "x"; then
24 # Installing into a sysroot 24 # Installing into a sysroot
25 SYSROOT="$D" 25 SYSROOT="$D"
26 OPT="--root $D" 26 OPT="--root $D"
27
28 # Make sure login.defs is there, this is to make debian package backend work
29 # correctly while doing rootfs.
30 # The problem here is that if /etc/login.defs is treated as a config file for
31 # shadow package, then while performing preinsts for packages that depend on
32 # shadow, there might only be /etc/login.def.dpkg-new there in root filesystem.
33 if [ ! -e $D${sysconfdir}/login.defs -a -e $D${sysconfdir}/login.defs.dpkg-new ]; then
34 cp $D${sysconfdir}/login.defs.dpkg-new $D${sysconfdir}/login.defs
35 fi
36
27 # user/group lookups should match useradd/groupadd --root 37 # user/group lookups should match useradd/groupadd --root
28 export PSEUDO_PASSWD="$SYSROOT:${STAGING_DIR_NATIVE}" 38 export PSEUDO_PASSWD="$SYSROOT:${STAGING_DIR_NATIVE}"
29fi 39fi