docs: Update documentation to reflect change from config/ to files/ (#283)

* docs: Update documentation to reflect change from `config/` to `files/`

* docs(files): Match documentation between template & module.yml

* docs(files): Add example about using subfolder

* docs(files): Some small style fixes

* docs: Fix `files/system` typo

Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>

* docs: Fix `files/system` typo pt. 2

Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>

* chore(files): Update typespec to be compatible with legacy & new recipe

Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>

---------

Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
This commit is contained in:
fiftydinar 2024-07-21 21:21:28 +02:00 committed by GitHub
parent 3b30283a6a
commit c0929e759c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 42 deletions

View file

@ -1,32 +1,32 @@
# `files`
The `files` module can be used to copy directories from `config/files` to
The `files` module can be used to copy directories from `files/` to
any location in your image at build time, as long as the location exists at
build time (e.g. you can't put files in `/home/<username>`, because users
build time (e.g. you can't put files in `/home/<username>/`, because users
haven't been created yet prior to first boot).
:::note
If you want to place files into `/etc`, there are two ways to do it:
If you want to place files into `/etc/`, there are two ways to do it:
1. copying a directory in `config/files` directly to `/etc` to add all of its
1. copying a directory in `files/` directly to `/etc` to add all of its
files at build time, or
2. putting the files you want there in `/usr/etc` as part of copying things
over to `/usr`, which `rpm-ostree` will then copy to `/etc` at runtime/boot.
2. putting the files you want there in `/usr/etc/` as part of copying things
over to `/usr/`, which `rpm-ostree` will then copy to `/etc/` at runtime/boot.
Typically, you will want to use the latter option (putting files in `/usr/etc`)
Typically, you will want to use the latter option (putting files in `/usr/etc/`)
in almost all cases, since that is the proper directory for "system"
configuration templates on atomic Fedora distros, whereas `/etc` is meant for
configuration templates on atomic Fedora distros, whereas `/etc/` is meant for
manual overrides and editing by the machine's admin *after* installation (see
issue https://github.com/blue-build/legacy-template/issues/28). However, if you
really need something to be in `/etc` *at build time* --- for instance, if you
for some reason need to place a repo file in `/etc/yum.repos.d` in such a way
really need something to be in `/etc/` *at build time* --- for instance, if you
for some reason need to place a repo file in `/etc/yum.repos.d/` in such a way
that it is used by a `rpm-ostree` module later on --- then the former option
will be necessary.
:::
:::caution
The `files` module **cannot write to directories that will later be symlinked
to point to other places (typically `/var`) by `rpm-ostree`**.
to point to other places (typically `/var/`) by `rpm-ostree`**.
This is because it doesn't make sense for a directory to be both a symlink and
a real directory that has had actual files directly copied to it, so the
@ -39,13 +39,13 @@ documentation](https://docs.fedoraproject.org/en-US/fedora-silverblue/technical-
here is a list of the directories that `rpm-ostree` symlinks to other
locations:
- `/home` → `/var/home`
- `/opt` → `/var/opt`
- `/srv` → `/var/srv`
- `/root` → `/var/roothome`
- `/usr/local` → `/var/usrlocal`
- `/mnt` → `/var/mnt`
- `/tmp` → `/sysroot/tmp`
- `/home/` → `/var/home/`
- `/opt/` → `/var/opt/`
- `/srv/` → `/var/srv/`
- `/root/` → `/var/roothome/`
- `/usr/local/` → `/var/usrlocal/`
- `/mnt/` → `/var/mnt/`
- `/tmp/` → `/sysroot/tmp/`
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

View file

@ -8,6 +8,9 @@ model FilesModule {
*/
type: "files";
/** List of files / folders to copy. Format is: `sourcefile.txt: /destination/file.txt` */
files: Array<Record<string>>;
}
/** List of files / folders to copy. */
files: Array<Record<string>> | Array<{
source: string;
destination: string;
}>;
}

View file

@ -6,8 +6,7 @@ example: |
modules:
- type: files
files:
- usr: /usr # copies config/files/usr into your images /usr
# put configuration files you want in /etc/ on a *booted*
# system in /usr/etc/ in the image.
- etc: /etc # copies config/files/etc into your image's /etc immediately,
# for use with further modules.
- source: system # copies `files/system/*` (* means everything inside it) into your image's root folder `/`
destination: /
- source: my-image/usr # copies `files/my-image/usr/*` to `/usr/` inside the image
destination: /usr