[oe-commits] Robert Yang : base-passwd: install passwd and group atomically
git at git.openembedded.org
git at git.openembedded.org
Thu Jul 10 16:40:31 UTC 2014
Module: openembedded-core.git
Branch: master-next
Commit: cdbe55215e3dd1b82a6c147a31c7c40186a8bf80
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=cdbe55215e3dd1b82a6c147a31c7c40186a8bf80
Author: Robert Yang <liezhi.yang at windriver.com>
Date: Sun Jul 6 21:40:37 2014 -0700
base-passwd: install passwd and group atomically
Fixed the race issue:
util-macros.do_package failed: 'getpwnam(): name not found: root'
The error happens when there is a half etc/passwd, fixed by:
$ install usr/share/base-passwd/passwd.master etc/passwd.master
$ mv etc/passwd.master etc/passwd
The "mv" is atomic which will fix this problem.
[YOCTO #6124]
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
---
meta/recipes-core/base-passwd/base-passwd_3.5.29.bb | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index 59bd413..ec8f2af 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -47,9 +47,14 @@ base_passwd_sstate_postinst() {
# put these files in the target sysroot so they can
# be used by recipes which use custom user/group
# permissions.
+ # Install passwd.master and group.master to sysconfdir and mv
+ # them to make sure they are atomically install.
install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master ${STAGING_DIR_TARGET}${sysconfdir}/passwd
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/group.master ${STAGING_DIR_TARGET}${sysconfdir}/group
+ for i in passwd group; do
+ install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \
+ ${STAGING_DIR_TARGET}${sysconfdir}/
+ mv ${STAGING_DIR_TARGET}${sysconfdir}/$i.master ${STAGING_DIR_TARGET}${sysconfdir}/$i
+ done
fi
}
More information about the Openembedded-commits
mailing list