https://blue-build.org/ logo
Can't seem to get file module to copy files.
# questions
p
In my recipe I have some files that I want to end up in /usr/local/bin. From the docs I can see that I therefore need to copy them to /var/usrlocal/bin - which I thought I was doing. Here's the relevant piece of the recipe:
Copy code
- type: files
    files:
      - source: system/usr
        destination: /usr
      - source: system/etc
        destination: /etc
      - source: system/var/usrlocal
        destination: /var/usrlocal
I'm sure I must be doing something very stupid, but I can't see what it is... Edit: for clarity the scripts I want to copy are in files/system/var/usrlocal/bin
a
message has been deleted
b
I haven't tried using subdirectories like that. I would put the usr and etc files etc into their own file under the files module. So you want to have your git repo read as files/etc and files/usr not files/system/etc or files/system/usr. I'm not sure if that's the issue, but try changing that and then change the recipe accordingly.
p
Thanks - I'll give that a go and report back.
That doesn't seem to have made a difference. There is also a cursors theme that is in files/system/usr/share/icons and, using the above file module config, that all seems to copy fine. Another search regarding this issue suggested that, perhaps, I needed to use the copy module because /usr/local/ is a symlink to /var/usrlocal. I tried this and the build fails anyway. I didn't think I needed to use copy for the simple reason I was copying to /var/usrlocal rather than /usr/local which couldn't work because it is (or will be) a symlink...
b
Oh shit, my dude, I did not think my response through when I made it. You can't make changes to var on blue build. The best way I can explain this is that /var is considered a persitant directory that has the current state of the actual system, so you can't change it from the image builder. This is the part of blue build in the docs where it says "think like a distribution". I know there's a way to install stuff to usrlocal, but I don't remember exactly. You probably just need to do that post build. FYI you can edit /etc as well, BUT any changes made by the user to the etc directory are persistent unless your image overwrites them. Only /usr is completely immutable (besides changes to the image).
p
I literally realised that var must be mutable about a minute before I saw your post. It's a bit of a shame that the whole image can't be a bit more scripted, but it's hardly a deal breaker.
a
message has been deleted
g
You can always write some systemd units to do the things that you can't do at build time.
b
I made a systemd unit for the grub config file if you want to look at that as an example.
p
That's actually not a bad idea...
yes please.
b
x
if you want these binaries on your image, why not put them in /usr/bin/?
that's what i do
b
unhelpfully, the docs say not to https://blue-build.org/reference/modules/files/
x
where does it say that? i can only see it saying to not put /etc/ in /usr/etc/ as was the previous recommendation, and to not use /usr/local/ on image
b
> So don’t use files to copy any files to any of the directories on the left, because at runtime rpm-ostree will want to link them to the ones on the right, which will cause a conflict as explained above.
I've never had any trouble dropping stuff in /usr/bin with it either, but it's one of many places where the docs need work
x
/usr/bin is not in this list
b
oh yeah I got mixed up. op was trying to put them in /usr/local (via /var/usrlocal) which the docs say is kosher when it's not, still had that in my head
upstream docs say it's kosher too, but you see what we've established. that's supposed to be a run time directory rather than a build time directory
make install
and
install
(when run as root) own usrlocal as far as I'm concerned. or
brew
, if it's set up in such a way
g
Our docs most definitely say you shouldn't put anything in
/usr/local/
> The files module cannot write to directories that will later be symlinked to point to other places (typically /var/) by rpm-ostree.
p
but it doesn't say not to put into /var/usrlocal... In fact specifically saying don'y copy files to the list on the left rather implies that it should be ok to copy to the ones on the right...