improve: enhance rootfs command robustness and flexibility
- Remove dependency on manifest parsing for reference discovery - Automatically detect and use first available OSTree reference - Simplify command usage - no need to parse treefile for reference name - Add better error handling for empty repositories - Improve user experience by showing which reference is being used - Make command more flexible for different use cases
This commit is contained in:
parent
bffba885bc
commit
aadf99a3e1
3 changed files with 101 additions and 32 deletions
83
minimal-treefile-with-kernel.yaml
Normal file
83
minimal-treefile-with-kernel.yaml
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
api_version: "1.0"
|
||||
kind: "tree"
|
||||
metadata:
|
||||
ref_name: "test/minimal"
|
||||
version: "0.1.0"
|
||||
description: "Minimal test tree for bootc image generation"
|
||||
repositories:
|
||||
- name: "debian"
|
||||
url: "http://deb.debian.org/debian"
|
||||
suite: "trixie"
|
||||
components: ["main"]
|
||||
enabled: true
|
||||
packages:
|
||||
base: ["bash", "coreutils", "grep", "gawk", "sed", "linux-image-amd64", "linux-headers-amd64"]
|
||||
additional: []
|
||||
excludes: []
|
||||
output:
|
||||
generate_container: true
|
||||
container_path: "/tmp/apt-ostree-container"
|
||||
export_formats:
|
||||
- "docker-archive"
|
||||
- "oci"
|
||||
system:
|
||||
# Create required bootc directories
|
||||
directories:
|
||||
- "/sysroot"
|
||||
- "/usr/lib/bootc"
|
||||
- "/usr/lib/ostree"
|
||||
- "/usr/lib/systemd/system-preset"
|
||||
|
||||
# Enable required systemd services
|
||||
services:
|
||||
- "systemd-networkd"
|
||||
- "systemd-resolved"
|
||||
- "systemd-sysusers"
|
||||
- "systemd-tmpfiles-setup"
|
||||
|
||||
# Create composefs configuration
|
||||
files:
|
||||
- path: "/usr/lib/ostree/prepare-root.conf"
|
||||
content: |
|
||||
[prepare-root]
|
||||
composefs=1
|
||||
composefs-store=/ostree/repo
|
||||
mode: "0644"
|
||||
owner: "root:root"
|
||||
|
||||
- path: "/usr/lib/bootc/install/00-debian.toml"
|
||||
content: |
|
||||
[install]
|
||||
filesystem = "ext4"
|
||||
root-fs-type = "ext4"
|
||||
|
||||
[install.kernel-args]
|
||||
default = ["console=ttyS0,115200", "quiet"]
|
||||
mode: "0644"
|
||||
owner: "root:root"
|
||||
|
||||
- path: "/usr/lib/systemd/tmpfiles.d/10-bootc.conf"
|
||||
content: |
|
||||
# Bootc required directories
|
||||
d /var/log 0755 root root
|
||||
d /var/cache 0755 root root
|
||||
d /var/tmp 1777 root root
|
||||
d /tmp 1777 root root
|
||||
d /run 0755 root root
|
||||
d /sysroot 0755 root root
|
||||
d /ostree 0755 root root
|
||||
d /boot 0755 root root
|
||||
mode: "0644"
|
||||
owner: "root:root"
|
||||
|
||||
# Post-installation cleanup and setup
|
||||
postinstall:
|
||||
- "echo 'Setting up bootc-compatible filesystem...'"
|
||||
- "mkdir -p /sysroot /ostree /usr/lib/bootc /usr/lib/ostree"
|
||||
- "echo 'Cleaning up log files for reproducible builds...'"
|
||||
- "find /var/log -type f -name '*.log' -delete"
|
||||
- "find /var/log -type f -name '*.log.*' -delete"
|
||||
- "find /var/cache -type f -delete"
|
||||
- "echo 'Setting up systemd tmpfiles...'"
|
||||
- "systemd-tmpfiles --create --remove"
|
||||
- "echo 'Bootc setup completed successfully'"
|
||||
Loading…
Add table
Add a link
Reference in a new issue