# 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 are 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 dontChroot is true, in the host system). Relative paths
#   are not recommended. There are three possible other keys in the map:
#   - *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.
#   - *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.
#   Only one of the two source keys (either *from* or *src*) may be set.
#
# The target filename is modified as follows:
#   - `@@ROOT@@` is replaced by the path to the target root (may be /)
#   - `@@USER@@` is replaced by the username entered by on the user
#       page (may be empty, for instance if no user page is enabled)
#
# Special values for the key *from* are:
# - *log*, for the complete log file (up to the moment the preservefiles
#   module is run),
# - *config*, for the Calamares configuration file
# - *globals*, for a JSON dump of the contents of global storage
---
files:
  - /etc/oem-information
  - from: log
    dest: /root/install.log
    perm: root:wheel:644
  - from: config
    dest: /root/install.cfg
    perm: root:wheel:400

# 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"