#!/bin/bash # # This tool generates a butane config file for the podman-quadlet-cookbook # project. The generated file can be used to provision a Fedora CoreOS # instance with all necessary quadlets and systemd units to run the # podman-quadlet-cookbook tests. # # It takes the following parameters: # - The target chroot directory where the quadlets and systemd units # have been installed. # - The path to a file containing a list of files and directories # (one per line) to ignore (i.e., files and directories that are # already part of the CoreOS default installation). # - The list of systemd main unit names to enable. # # It outputs the butane config file to stdout. # set -Eeuo pipefail TARGET_CHROOT="$1" IGNORE_LIST_FILE="$2" SYSTEMD_MAIN_UNIT_NAMES="${@:3}" cat <<"EOF" variant: fcos version: 1.4.0 storage: files: EOF for file in $(find "$TARGET_CHROOT" \! -type d); do rel_path="${file#$TARGET_CHROOT}" if grep -qxF "$rel_path" "$IGNORE_LIST_FILE"; then # Skip files & directories that are already part of the CoreOS default installation continue fi cat <