Re: [OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
On Fri, 2011-10-21 at 03:31 +, Otavio Salvador wrote: @@ -37,7 +37,7 @@ do_install () { install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ } -pkg_postinst_${PN} () { +pkg_preinst_${PN} () { set -e if [ ! -e $D${sysconfdir}/passwd ] ; then Doesn't this break on-target installs (or, more generally, installs where preinst runs before unpacking)? p. ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
On Fri, Oct 21, 2011 at 04:52, Phil Blundell ph...@gnu.org wrote: On Fri, 2011-10-21 at 03:31 +, Otavio Salvador wrote: @@ -37,7 +37,7 @@ do_install () { install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ } -pkg_postinst_${PN} () { +pkg_preinst_${PN} () { set -e if [ ! -e $D${sysconfdir}/passwd ] ; then Doesn't this break on-target installs (or, more generally, installs where preinst runs before unpacking)? It does indeed. I will fix it and send a new patch for it. -- Otavio Salvador O.S. Systems E-mail: ota...@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
To allow use and manipulation of users and groups at rootfs building time, the '/etc/passwd' and '/etc/group' needs to be available as soon as possible. Signed-off-by: Otavio Salvador ota...@ossystems.com.br --- .../recipes-core/base-passwd/base-passwd_3.5.22.bb | 19 ++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb index 137512d..aa90a6d 100644 --- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb +++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb @@ -1,7 +1,7 @@ SUMMARY = Base system master password/group files. DESCRIPTION = The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files. SECTION = base -PR = r3 +PR = r4 LICENSE = GPLv2+ LIC_FILES_CHKSUM = file://COPYING;md5=eb723b61539feef013de476e68b5c50a @@ -37,6 +37,23 @@ do_install () { install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ } +pkg_preinst_${PN} () { + set -e + + # Used for rootfs generation. On in-target install this will be run +# before the unpack so the files won't be available + + if [ ! -e $D${sysconfdir}/passwd ] [ -e $D${datadir}/base-passwd/passwd.master ]; then + cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd + fi + + if [ ! -e $D${sysconfdir}/group ] [ -e $D${datadir}/base-passwd/group.master ]; then + cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group + fi + + exit 0 +} + pkg_postinst_${PN} () { set -e -- 1.7.2.5 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
I've seen other distributions solve this doing this by creating the passwd/group files based on the contents of the recipe and not some external file. So you would have a list of users/groups that need to be created with their attributes. In the do_install these items would be dumped into the passwd/group.master file(s). But also in the preinst, it would check for the existence of the files -- if they didn't exist yet.. it would simply write out the passwd/group files at that point. By embedding the data in the recipe, it keeps things in sync and resolves the chicken/egg problem. Any opinions from folks if this is even halfway reasonable for us to consider? (I'm guessing with some anon python code we could probably load in the passwd/group files, place them into a variable and use the variable to embed them within the preinst -- keeping the contents out of the recipe.) --Mark On 10/21/11 9:10 AM, Otavio Salvador wrote: To allow use and manipulation of users and groups at rootfs building time, the '/etc/passwd' and '/etc/group' needs to be available as soon as possible. Signed-off-by: Otavio Salvador ota...@ossystems.com.br --- .../recipes-core/base-passwd/base-passwd_3.5.22.bb | 19 ++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb index 137512d..aa90a6d 100644 --- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb +++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb @@ -1,7 +1,7 @@ SUMMARY = Base system master password/group files. DESCRIPTION = The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files. SECTION = base -PR = r3 +PR = r4 LICENSE = GPLv2+ LIC_FILES_CHKSUM = file://COPYING;md5=eb723b61539feef013de476e68b5c50a @@ -37,6 +37,23 @@ do_install () { install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ } +pkg_preinst_${PN} () { + set -e + + # Used for rootfs generation. On in-target install this will be run +# before the unpack so the files won't be available + + if [ ! -e $D${sysconfdir}/passwd ] [ -e $D${datadir}/base-passwd/passwd.master ]; then + cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd + fi + + if [ ! -e $D${sysconfdir}/group ] [ -e $D${datadir}/base-passwd/group.master ]; then + cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group + fi + + exit 0 +} + pkg_postinst_${PN} () { set -e ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
On Fri, Oct 21, 2011 at 12:52, Mark Hatle mark.ha...@windriver.com wrote: ... Any opinions from folks if this is even halfway reasonable for us to consider? (I'm guessing with some anon python code we could probably load in the passwd/group files, place them into a variable and use the variable to embed them within the preinst -- keeping the contents out of the recipe.) I like this idea but I'd prefer to have this merged before it. -- Otavio Salvador O.S. Systems E-mail: ota...@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/4] base-passwd: move initial criation of group and passwd to preinst
To allow use and manipulation of users and groups at rootfs building time, the '/etc/passwd' and '/etc/group' needs to be available as soon as possible. Signed-off-by: Otavio Salvador ota...@ossystems.com.br --- .../recipes-core/base-passwd/base-passwd_3.5.22.bb |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb index 137512d..9f81ba3 100644 --- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb +++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb @@ -1,7 +1,7 @@ SUMMARY = Base system master password/group files. DESCRIPTION = The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files. SECTION = base -PR = r3 +PR = r4 LICENSE = GPLv2+ LIC_FILES_CHKSUM = file://COPYING;md5=eb723b61539feef013de476e68b5c50a @@ -37,7 +37,7 @@ do_install () { install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ } -pkg_postinst_${PN} () { +pkg_preinst_${PN} () { set -e if [ ! -e $D${sysconfdir}/passwd ] ; then -- 1.7.2.5 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core