# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Unpack a filesystem. Supported ways to "pack" the filesystem are:
#   - erofs
#     Enhanced Read-Only File System is a relatively new filesystem, introduced
#     in 2019 with Linux 5.4, which is optimised for runtime performance. EROFS
#     has compression options similar to that of SquashFS, however, in
#     direct head to head comparison, as of 2025, the EROFS compression
#     algorithms are not as performant; it takes longer to pack a filesystem and
#     the compression size is not quite as good. EROFS is under active
#     development.
#     .
#     Wikipedia: https://en.wikipedia.org/wiki/EROFS
#     Upstream documentation: https://erofs.docs.kernel.org/en/latest/
#     .
#     erofs-utils contains mkfs.erofs, fsck.erofs and dump.erofs utilities
#     which are required to pack, inspect and extract erofs files.
#   - fsarchiver in *savedir/restdir* mode (directories, not block devices)
#   - squashfs
#     SquashFS is a compressed read-only file system for Linux that was
#     introduced in 2002. It supports deduplication and has mature and
#     performant compression algorithms.
#     .
#     Wikipedia: https://en.wikipedia.org/wiki/SquashFS
#     Upstream documentation: https://github.com/plougher/squashfs-tools
#     .
#     squashfs-tools contains mksquashfs and unsquashfs utilities which are
#     required to pack and extract squashfs files.
#
# Configuration:
#
#   from globalstorage: rootMountPoint
#   from job configuration: the item to unpack
#

---
# This module is configured a lot like the items in the *unpackfs*
# module, but with only **one** item. Use multiple instances for
# unpacking more than one filesystem.
#
# There are the following **mandatory** keys:
#   - *source* path relative to the live / intstalling system to the image
#   - *sourcefs* the type of the source files; valid entries are
#       - `none` (this entry is ignored; kind of useless)
#       - `erofs`
#       - `fsarchiver`
#         Aliases of this are `fsarchive`, `fsa` and `fsa-dir`. Uses
#         fsarchiver in "restdir" mode.
#       - `fsarchiver-block`
#         Aliases of this are `fsa-block` and `fsa-fs`. Uses fsarchiver
#         in "restfs" mode.
#       - `squashfs`
#         Aliases of this are `squash` and `unsquash`.
#       - `tar`
#   - *destination* path relative to rootMountPoint (so in the target
#       system) where this filesystem is unpacked. It may be an
#       empty string, which effectively is / (the root) of the target
#       system.
#
#
# There are the following **optional** keys:
#   - *condition* sets a dynamic condition on unpacking the item in
#     this job. This may be true or false (constant) or name a globalstorage
#     value. Use '.' to separate parts of a globalstorage name if it is nested.
#     Remember to quote names.
#
#     A condition is used in e.g. stacked squashfses, where the user can select
#     a specific install type. The default value of *condition* is true.

source: /data/rootfs.fsa
sourcefs: fsarchiver
destination: "/"
# condition: true
