All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
To: Laurent Gauthier <laurent.gauthier@soccasys.com>
Cc: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: useradd and one sysroot per recipe in pyro
Date: Wed, 14 Jun 2017 12:47:14 -0500	[thread overview]
Message-ID: <1497462434.29576.13.camel@linux.intel.com> (raw)
In-Reply-To: <CAGbd71R8RRyuS+mDnfUsjriShpju=9VFrDNtxfWFWevs5YMhfQ@mail.gmail.com>

On Wed, 2017-06-14 at 18:12 +0200, Laurent Gauthier wrote:
> Hi Christian,
> 
> In pyro the creation of users and group (using the useradd class) is
> done during the package pre-installation.
> 
> So my best guess is that you could move the owner/group change in the
> package post-installation as follows:
> 
> do_install () {
>             (…)
>             install -d ${D}${sysconfdir}/myappl
>             install -d ${D}${localstatedir}/lib/myappl
> }
> 
> pkg_postinst_${PN} () {
>             chown -R myuser:mygroup ${D}${sysconfdir}/myappl
>             chown -R myuser:mygroup ${D}${localstatedir}/lib/myappl
> }
> 
> I hope this helps.

also, at the oe-core repo, you can find a recipe example


meta-skeleton/recipes-skeleton/useradd/useradd-example.bb


> 
> Laurent.
> 
> On Wed, Jun 14, 2017 at 5:57 PM, Andersen, Christian
> <c.andersen@kostal.com> wrote:
> > Any ideas how to use „useradd“ bbclass with pyro?
> >
> > If I move useradd to my recipe my-appl.bb, it works. But there are more
> > recipes depending on the added user, so I want to add this user in a
> > base-recipe and just depend on it using (DEPENDS/RDEPENDS).
> >
> > Regards
> > Christian
> >
> >
> >
> > Von: Andersen, Christian
> > Gesendet: Dienstag, 13. Juni 2017 18:10
> > An: 'yocto@yoctoproject.org' <yocto@yoctoproject.org>
> > Betreff: useradd and one sysroot per recipe in pyro
> >
> >
> >
> > Hello,
> >
> >
> >
> > currently I am trying the newest Yocto release (pyro). It seems I have a
> > problem with useradd and the new concept of one sysroot per recipe.
> >
> >
> >
> > I have a base recipe (let’s call it my-base.bb) which inherits useradd and
> > creates a new user (let’s call him myuser):
> >
> >
> >
> > inherit useradd
> >
> >
> >
> > USERADD_PACKAGES = "${PN}"
> >
> > USERADD_PARAM_${PN} = " \
> >
> >     --uid 1200 \
> >
> >     --gid 1200 \
> >
> >     --system \
> >
> >     --shell /bin/bash \
> >
> >     --create-home \
> >
> >     --home-dir /home/myuser \
> >
> >     --groups mygroup,video,input \
> >
> >     myuser"
> >
> > GROUPADD_PARAM_${PN} = "-g 1200 mygroup"
> >
> >
> >
> > do_install () {
> >
> > install -d ${D}/home/myuser
> >
> >             chown -R myuser:mygroup ${D}/home/myuser
> >
> > }
> >
> >
> >
> > Other recipes depend on this base recipe (via DEPENDS and RDEPENDS), because
> > they require this user, e.g. in recipe my-appl.bb (in this case python only,
> > so no configure or compile):
> >
> >
> >
> > DEPENDS = "puck-base"
> >
> > RDEPENDS_${PN} = "puck-base python3-dbus python3-sqlite3 python3-netclient
> > python3-requests"
> >
> >
> >
> > do_configure[noexec] = "1"
> >
> > do_compile[noexec] = "1"
> >
> >
> >
> > do_install () {
> >
> >             (…)
> >
> >
> >
> > install -d ${D}${sysconfdir}/myappl
> >
> >             chown -R myuser:mygroup ${D}${sysconfdir}/myappl
> >
> >
> >
> > install -d ${D}${localstatedir}/lib/myappl
> >
> >             chown -R myuser:mygroup ${D}${localstatedir}/lib/myappl
> >
> > }
> >
> >
> >
> > Unfortunately I get an error when building the recipe my-appl.bb
> >
> >
> >
> > | chown: invalid user: ‘myuser:mygroup’
> >
> > | WARNING: exit code 1 from a shell command.
> >
> > | ERROR: Function failed: do_install (log file is located at …)
> >
> > ERROR: Task (…/my-appl.bb:do_install) failed with exit code '1'
> >
> >
> >
> > In morty the user was created in the shared sysroot. But using pyro the user
> > is not created in the recipe-sysroot.
> >
> >
> >
> > What am I doing wrong and is there a way to solve this?
> >
> >
> >
> > Thanks in advance!
> >
> > Regards
> >
> > Christian
> >
> > KOSTAL Industrie Elektrik GmbH - Sitz Lüdenscheid, Registergericht Iserlohn
> > HRB 3924 - USt-Id-Nr./Vat No.: DE 813742170
> > Postanschrift: An der Bellmerei 10, D-58513 Lüdenscheid * Telefon: +49 2351
> > 16-0 * Telefax: +49 2351 16-2400
> > Werksanschrift: Lange Eck 11, D-58099 Hagen * Tel. +49 2331 8040-800 * Fax
> > +49 2331 8040-602
> > Geschäftsführung: Axel Zimmermann, Dipl.-Ing. Marwin Kinzl, Dipl.-Oec.
> > Andreas Kostal
> >
> > --
> > _______________________________________________
> > yocto mailing list
> > yocto@yoctoproject.org
> > https://lists.yoctoproject.org/listinfo/yocto
> >
> 
> 
> 
> -- 
> Laurent Gauthier
> Phone: +33 630 483 429
> http://soccasys.com




  reply	other threads:[~2017-06-14 17:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 15:57 useradd and one sysroot per recipe in pyro Andersen, Christian
2017-06-14 16:12 ` Laurent Gauthier
2017-06-14 17:47   ` Leonardo Sandoval [this message]
2017-06-20  7:22   ` Andersen, Christian
  -- strict thread matches above, loose matches on Subject: below --
2017-06-13 16:10 Andersen, Christian
2017-06-14 15:25 ` Maxin B. John
2017-06-14 16:13   ` Andersen, Christian
2017-06-15  8:23     ` Maxin B. John
2017-06-20  7:19       ` Andersen, Christian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497462434.29576.13.camel@linux.intel.com \
    --to=leonardo.sandoval.gonzalez@linux.intel.com \
    --cc=laurent.gauthier@soccasys.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.