From: [email protected] <[email protected]> On Behalf Of 
linusnilsson via lists.yoctoproject.org
Sent: Thursday, April 11, 2024 9:53
To: [email protected]
Subject: [yocto] Correct way for multiple recipes to install files in the same 
directory


> Hi!
> How/can I let multiple recipes install files in the same directory without 
> getting a conflict during bitbake process?
>
> Recipe 1 creates a user and its homedir:
> inherit useradd
> USERADD_PACKAGES = "${PN}"
> USERADD_PARAM:${PN} = "-u 1000 -d /home/user1 -m -s /bin/bash -p 'XXX' user1"
> do_install(){
>  install -d ${D}/home/user1
>  chown -R user1:user1 ${D}/home/user1
> }
>
> Recipe 2 wants to install some config-files inside /home/user1/.config/.
> DEPENDS = "recipe1"
> RDEPENDS:${PN} = "recipe1"
> do_install(){
>  install -d ${D}/home/user1/.config/
>  install -m 0644 sourcefile ${D}/home/user1/.config/
>  chown -R user1:user1 ${D}/home/user1/.config/

Have you tried to change this line to

chown -R user1:user1 ${D}/home/user1

The error may come from fact that directory /home/user1 has different ownership 
in both recipes
> }
>
> There is also FILES directives at the end of each recipe for the 
> corresponding files. For better readability I've removed everything that I 
> deemed was irrelevant.
> The problem I get when trying to bitbake the image is during the do_rootfs 
> stage:
> file /home/user1 conflicts between attempted installs of <recipe2> and 
> <recipe1>
>
> If I comment out the "chown" line from both recipes it seems to work but then 
> I guess those directories will be owned by root during runtime, which will be 
> a problem for user1.
>
> Is there a proper way to do this?
>
> Kind regards, Linus
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62916): https://lists.yoctoproject.org/g/yocto/message/62916
Mute This Topic: https://lists.yoctoproject.org/mt/105458437/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to