go-yaml/yaml has been deprecated by its maintainer; Move to goccy/go-yaml, which is
an actively maintained from a scratch yaml implementation in pure go. It
should able to parse all yaml file go-yaml could, and more. As an extra
benefit its errors are a lot better.
Fixes: #592
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Let verify (indirectly) save the cleaned keyring paths back to the
action arguments so those are used for the Run as well
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Unconditionally log SHA256 sum of downloads and add an optional
sha256sum property. Setting this property will ensure verification of
the downloaded file and delete it on mismatch.
Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Passing -e to sh makes the action to fail immediately instead of
continuing to the next commands.
Fixes: #290
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
Add a 'partattrs' property to partitions. It allows the GPT partition
attribute bits to be set for a partition. Notably this is needed to set
bits 48 and 56, which are part of the GUID specific range, to allow a
ChromeOS Kernel partition to be booted on Chromebooks.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Debian Bookworm includes a version of tar with native support
for Zstandard compression.
Add mapping to enable zstd in pack and unpack operations.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Newer storage, such as UFS or NVMe disk, may not support the
default 512 sector size.
For these devices, the partition table and the partition offset
need to be aligned with sector size boundaries. The GPT partition
table is 34 sectors in length, so we can't have compatible disk images
between 512 and 4096 sector-size devices.
This patch introduces a major breakage with the {{ sector 64 }}
template.
At template processing, we can't guess the appropriate sector size
for the image since this value can be defined as a YAML header.
Instead of multiplying the sector number by the default 512 bytes
boundary, append a 's' suffix. This defers the work of computing
the value to the different Actions.
The 's' suffix is chosen to be compatible with parted (ImagePartition)
and support has been added to raw action.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Allow to set arbitrary apt options via yaml keyword `apt-opts`. One
particular use case in to create minimal embedded image where things
like recommendations are not needed. These can be omitted during
setup with the apt options `APT::Install-Recommends` and
`APT::Install-Suggests` to "false. All other apt options do also work.
As stated in the mmdebstrap man page [1] these options are persisted in
/etc/apt/apt.conf.d/99mmdebstrap, so further calls to apt will respect
these options too.
[1] https://manpages.debian.org/testing/mmdebstrap/mmdebstrap.1.en.html#aptopt
Signed-off-by: Nicolai Buchwitz <nb+github@tipi-net.de>
Allow to set arbitrary dpkg options via yaml keyword `dpkg-opts`. One
particular use case in to create minimal embedded image where things
like docs and man pages are not needed. These can be omitted during
setup with the dpkg option `path-exclude`. All other dpkg options do
also work.
As stated in the mmdebstrap man page [1] these options are persisted in
/etc/dpkg/dpkg.cfg.d/99mmdebstrap, so further calls to dpkg will respect
these options too.
[1] https://manpages.debian.org/testing/mmdebstrap/mmdebstrap.1.en.html#dpkgopt
Signed-off-by: Nicolai Buchwitz <nb+github@tipi-net.de>
Add include option for mmdebstrap.
The include option of mmdebstrap specifies the packages to be installed during
bootstrap image.
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Added optional fslabel property to partition to allow truncation of filesystem
label and allow user to modify filesystem label without modifying the name.
Filesystem label defaults to the name property of the partition.
The filesystem label can be up to 11 characters long for {v}fat{12|16|32},
16 characters long for ext2/3/4, 255 characters long for btrfs, 512 characters
long for hfs/hfsplus and 12 characters long for xfs.
Fixes: #251
Suggested-by: Christopher Obbard <chris.obbard@collabora.com>
Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
We should be consistent and return an error to bubble up rather
than logging the error.
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
The paths used aren't consistent in the log, e.g.:
2024/12/17 15:56:10 ==== Deploy onto image ====
2024/12/17 15:56:21 Setting up fstab
2024/12/17 15:56:21 Setting up /etc/kernel/cmdline
For all log and error messages, use the full path to fstab and cmdline.
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
Recent changes introduced a tuned formatting of the partitions created
with FAT{12|16|32}. The issue is that fstab is generated using the fs
property which won't match the system expectations.
If the fs property is "fat", "fat12", "fat16", "fat32" or "msdos", then
fstab must use "vfat".
Signed-off-by: Aymen Zayet <aymen.zayet@flex.ai>
The regression was introduced with the following commit :
commit 94fedb2c0c
Author: Christopher Obbard <chris.obbard@collabora.com>
Date: Tue Mar 19 17:43:42 2024 +0000
actions: image-partition: enable creation of FAT{12|16|32} partitions
This one added more options when it comes to creating FAT partitions.
So when partition fs is defined as "fat", "fat12", "fat16", "fat32",
"msdos" or "vfat", then mkfs.vfat is used to create the partition,
and different options were used depending on the FAT type.
The main issue is that mounting a FAT partition should use "vfat"
as fs type when using syscall.Mount().
So, in order to fix this issue, "vfat" is simply used to mount "fat",
"fat12", "fat16", "fat32" or "msdos" partitions.
Signed-off-by: Aymen Zayet <aymen.zayet@flex.ai>
From the path module doc:
If the path is empty, Base returns ".". If the path consists
entirely of slashes, Base returns "/".
Actually validate that we provide a filename when one is required,
rather than failing with an error that /scratch exists but is not a
file.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're unpacking individual actions, pass YAML parsing errors up to
the caller instead of silently ignoring them.
Signed-off-by: Daniel Stone <daniels@collabora.com>