# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Configuration for the preserve-files job
#
# The *files* key contains a list of files to preserve. Each element of
# the list should have one of these forms:
#
# - an absolute path (probably within the host system). This will be preserved
#   as the same path within the target system (chroot). If, globally,
#   *dontChroot* is true, then these items will be ignored (since the
#   destination is the same as the source).
# - a map with a *dest* key. The *dest* value is a path interpreted in the
#   target system (if the global *dontChroot* is true, then the host is the
#   target as well). Relative paths are not recommended. There are two
#   ways to select the source data for the file:
#   - *from*, which must have one of the values, below; it is used to
#     preserve files whose pathname is known to Calamares internally.
#   - *src*, to refer to a path interpreted in the host system. Relative
#     paths are not recommended, and are interpreted relative to where
#     Calamares is being run.
#   Exactly one of the two source keys (either *from* or *src*) must be set.
#
#   Special values for the key *from* are:
#     - *log*, for the complete log file (up to the moment the preservefiles
#       module is run),
#     - *config*, for a JSON dump of the contents of global storage.
#       Note that this may contain sensitive information, and should be
#       given restrictive permissions.
#
#  A map with a *dest* key can have these additional fields:
#   - *perm*, is a colon-separated tuple of <user>:<group>:<mode>
#     where <mode> is in octal (e.g. 4777 for wide-open, 0400 for read-only
#     by owner). If set, the file's ownership and permissions are set to
#     those values within the target system; if not set, no permissions
#     are changed.
#   - *optional*, is a boolean; if this is set to `true` then failure to
#     preserve the file will **not** be counted as a failure of the
#     module, and installation will proceed. Set this for files that might
#     not exist in the host system (e.g. nvidia configuration files that
#     are created in some boot scenarios and not in others).
#
# The target path (*dest*) is modified as follows:
#   - `@@ROOT@@` is replaced by the path to the target root (may be /).
#     There is never any reason to use this, since the *dest* is already
#     interpreted in the target system.
#   - `@@USER@@` is replaced by the username entered by on the user
#       page (may be empty, for instance if no user page is enabled)
#
#
#
files:
  - from: log
    dest: /var/log/Calamares.log
    perm: root:root:644
  - from: config
    dest: /var/log/Calamares-install.json
    perm: root:root:644
# - src: /var/log/nvidia.conf
#   dest: /var/log/Calamares-nvidia.conf
#   optional: true

# The *perm* key contains a default value to apply to all files listed
# above that do not have a *perm* key of their own. If not set,
# root:root:0400 (highly restrictive) is used.
#
# perm: "root:root:0400"
