From e7d87ad11d72e9841ad5a7b6569e5564a3574c73 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Sun, 24 Sep 2023 05:18:05 +0700 Subject: [PATCH] update more stuff --- .github/workflows/arm-build.yml | 4 ++-- README.md | 21 +++++++++++++++++++-- src/creator.rs | 16 ++++++++++++++-- tests/katsudon-arm.yaml | 16 +++++++++++++--- tests/postinst.sh | 2 +- 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/.github/workflows/arm-build.yml b/.github/workflows/arm-build.yml index 56fc30a..7f8ac0b 100644 --- a/.github/workflows/arm-build.yml +++ b/.github/workflows/arm-build.yml @@ -51,8 +51,8 @@ jobs: cargo \ moby-engine - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - uses: Swatinem/rust-cache@v2 diff --git a/README.md b/README.md index 47be2eb..c21f635 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,24 @@ -# katsu -An experimental image builder for RPM/DNF based systems. +# Katsu + +> An experimental image builder for RPM/DNF based systems. + +Katsu is a tool for building bootable images from RPM based systems. It is an alternative Lennart Poettering's [mkosi](https://github.com/systemd/mkosi) tool, designed to be robust, fast, and easy to use while still providing many output formats. It is Ultramarine Linux's new image builder from Ultramarine 39 onwards. + +Katsu currently supports the following output formats: + +- ISO 9660 disc images +- RAW disk images + +## Why Katsu? + +Katsu stemmed from our frustration with Fedora's Lorax/OSBuild toolchain. Lorax is a very complex Python application that relies on another complex Python application, Anaconda, to build images. Then on top of that uses hard-to-read Mako templates to configure the image on top. + +We found it difficult to work with Lorax and Anaconda, and we wanted to build images in a more straightforward way where we can control any aspect of the image building process down to the filesystem layout. And thus, Katsu was born. + +Katsu uses YAML configuration files to describe the image, with modular manifests similar to the likes of rpm-ostree. This makes it easy to read, write, and maintain Katsu configurations. ## Dependencies + - `xorriso` - `dracut` - `limine` or `grub2` diff --git a/src/creator.rs b/src/creator.rs index dcc8800..973f880 100644 --- a/src/creator.rs +++ b/src/creator.rs @@ -174,7 +174,7 @@ pub trait ImageCreator { self.init_script()?; self.instpkgs()?; // self.dracut()?; - // self.rootpw()?; + self.rootpw()?; self.postinst_script()?; // self.squashfs()?; @@ -570,10 +570,22 @@ pub trait ImageCreator { extra_args.push("--forcearch"); extra_args.push(cfg.arch.as_ref().unwrap()); } + prepare_chroot(root).unwrap_or_else(|e| { + error!(?e, "Failed to prepare chroot"); + std::process::exit(1); + }); cmd_lib::run_cmd!( $dnf in -y --releasever=$rel $[extra_args] --installroot $root $[pkgs]; $dnf clean all; - )?; + ).unwrap_or_else(|e| { + error!(?e, "Failed to install packages"); + unmount_chroot(root).unwrap_or_else(|e| { + error!(?e, "Failed to unmount chroot"); + std::process::exit(1); + }); + std::process::exit(1); + }); + unmount_chroot(root)?; Ok(()) } } diff --git a/tests/katsudon-arm.yaml b/tests/katsudon-arm.yaml index b9e09f8..9faa0fd 100644 --- a/tests/katsudon-arm.yaml +++ b/tests/katsudon-arm.yaml @@ -15,7 +15,6 @@ packages: - btrfs-progs - dmraid - nvme-cli - - dbus-daemon # necessary stuff - "@core" - fedora-repos @@ -35,11 +34,22 @@ packages: - chrony - dracut-config-generic - "@arm-tools" + # - "-dracut-config-rescue" + - chrony + - "@hardware-support" + # - "-iwl*" + # - "-ipw*" + # - "-usb_modeswitch" + - grub2-efi-aa64 + - grub2-efi-aa64-modules + - grub2-efi-aa64-cdboot + - grub2-tools + disk: bootloader: true - root_format: btrfs - disk_size: 8G + root_format: xfs + disk_size: 6G sys: releasever: 38 diff --git a/tests/postinst.sh b/tests/postinst.sh index 84530dc..948e036 100755 --- a/tests/postinst.sh +++ b/tests/postinst.sh @@ -18,7 +18,7 @@ echo max_parallel_downloads=20 >> /etc/dnf/dnf.conf echo defaultyes=True >> /etc/dnf/dnf.conf systemd-sysusers - +cp -P /usr/share/uboot/rpi_arm64/u-boot.bin /boot/efi/rpi-u-boot.bin cp -P /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin cp -P /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin rm -f /var/lib/systemd/random-seed