Skip to content

Transfer of major fixes - #39

Open
justpav05 wants to merge 135 commits into
mainfrom
dev
Open

justpav05 wants to merge 135 commits into
mainfrom
dev

Conversation

@justpav05

Copy link
Copy Markdown
Collaborator

Key changes:

  • Added more tests
  • Fixed UKI boot format creation and functionality
  • Added GRUB installation
  • Added installation of other bootloaders into the image
  • Added a hook for post-installation and verification
  • Fixed initial image installation: everything is now split into packages

justpav05 and others added 30 commits September 5, 2026 11:09
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
package structure

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: addition of functions for understanding the booters

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: removed unnecessary constants

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
justpav05 and others added 30 commits September 11, 2026 18:53
upac_types::states as SetupStateId — genesis now shares the same
CommandState machinery as every other command, since it's gaining a real
C-ABI request surface

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
requests now have a domain to report errors under, matching every other
commandA

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
functions across the two crates
fix: moved the error trait to the traits module

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: context macros are now exported

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
instead of `.0`), fix mime rendering.rs's Context key mismatch (was
storing DecoderManifests but reading back a raw HashMap), and derive
ContextValue for DecoderManifests so its `.0` access can drop out at
call sites

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
display them individually

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
forcing --removable --no-nvram, matching systemd-boot/refind's own
install tools; update booter.toml's stale rationale comment

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
WrittenBootEntry enum (Bls/Uki) so callers branch on the actual
boot-resource kind instead of comparing entry_name against a magic UKI
slot constant

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
installers (refind-install/bootctl), matching grub's already-real
install()

Also wires up install()'s C-ABI entry point for uki/refind/systemd-boot,
which was a hardcoded stub always returning 0 without ever calling the
backend — plugin.install() goes exclusively through this extern "C" fn
in both static and dynamic link modes, so uki's existing register_slot
NVRAM logic never actually ran either. booter.toml gains install_bin for
both plugins; systemd-boot's build.rs now generates both the shared
[boot] and its own [systemd_boot] section like refind already did.

refactor: propagate the real ErrorKind through boot-plugin
request-conversion errors instead of discarding it to a hardcoded
InvalidRequest

Adds From<ErrorKind> for GrubError/UkiError/RefindError/SystemdBootError
(PermissionDenied passes through, everything else still falls back to
InvalidRequest) so try_from(...).map_err(XxxError::from) can reuse it
instead of a closure that threw the conversion error away.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
export boundary
(setup_existing/setup_whole_disk/setup_abi_version/cancel), matching
upac-lib's own export/mod.rs

Renames lib/setup/src/genesis/ to stages/ (source.rs->prepare.rs,
embed.rs->database.rs, entry.rs->boot.rs), extracts SourceArchive into
its own archive.rs, and drops the old genesis/types.rs and data.rs in
favor of SetupExistingData/SetupWholeDiskData built directly from the
new CSetupExistingRequest/CSetupWholeDiskRequest C-ABI types. Real boot
stage: resolves the boot plugin, calls
install()/write_boot_entry()/set_one_shot(), UKI to/from-slot seed-copy.
Manual-mode ESP partition geometry (partition number, starting/ending
LBA, unique GUID) is now auto-detected from the existing GPT via a new
partition::existing_esp_geometry() instead of being silently zeroed, so
TargetSysroot no longer needs Option-wrapped geometry fields at all.
Adds error.rs's missing From<SetupError> for ErrorKind and the crate's
[lib] crate-type (cdylib+rlib), so the new extern "C" fns are actually
exportable for up-sp to link against, either dynamically or statically.
Kernel stage stays a no-op stub — tracked separately

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
WrittenBootEntry return type, matching installer/update/rollback's
already-fixed call sites

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
`setup_cancel`

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
C-ABI export functions, mirroring up's own libcore.rs/types::errors
pattern

Reorganizes src/ into upac-cli's types/{mod,errors,progress}.rs shape,
adds libcore.rs (Lib::load() resolving
setup_existing/setup_whole_disk/setup_cancel/setup_abi_version as static
fn pointers — always static-link, genesis has nowhere to dlopen a .so
from on a blank disk) plus a shared invoke() helper.
commands/{auto,manual}.rs (whole_disk.rs renamed to auto.rs) now build
SetupExistingRequest/SetupWholeDiskRequest and cross the C-ABI boundary
directly instead of calling
upac_setup::stages::run_existing/run_whole_disk as plain Rust.
types::errors::LibError/error_kind_message replace the old rich
SetupError Display impl, formatting straight off CError's
domain-agnostic ErrorKind + SetupStateId::from_stage_index — same shape
up already uses, just scoped to one domain. i18n keys swapped to the
generic ErrorKind set to match.

Renames upac-setup's own cancel export to setup_cancel — it collided
with upac-lib's identically-named #[no_mangle] cancel, which also ends
up statically linked into up-sp since upac-setup depends on upac-lib for
its own package-install machinery

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
plugin instead of whichever single one happens to exist

Adds BootResourceKind (Bls/Uki, same axis WrittenBootEntry already uses)
as a new required Booter trait method plus C-ABI query
(boot_resource_kind, BOOT_ABI_VERSION 2->3), implemented by all four
booter plugins (uki -> Uki, grub/systemd-boot/refind -> Bls) and
threaded through BootPlugin/static_link.rs/dynamic_link.rs.
write_boot_entry now takes the wanted kind and filters
get_boot_resources() against it — errors UnsupportedBootResource if the
wanted kind is absent even when a different kind is present,
AmbiguousBootResource only among matches of the wanted kind,
NoBootResource only when the tree has nothing at all.

Reorders all 5 ordinary checkout.rs stages
(installer/update/rollback/files/uninstaller) to resolve the boot plugin
before calling write_boot_entry, since the call now needs
plugin.boot_resource_kind() as an argument — genesis's own
stages/boot.rs already had the right order. Closes the two TODO.md items
about write_boot_entry's resource-selection blindness and the
checkout.rs call ordering

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cancel/version_abi never got renamed to lib_cancel/lib_abi_version)

The static-link path referenced upac::export::{cancel, version_abi} and
upac_abi::ABI_VERSION, none of which exist anymore — upac-lib's own
export/mod.rs already uses lib_cancel/lib_abi_version/LIB_ABI_VERSION,
but the dynamic-plugins dlopen path (which resolves symbols by string
name) had the same stale "cancel"/"version_abi" names too. Both paths
now agree with what upac-lib actually exports; `cargo clippy -p upac-cli
-p upac-lib --no-default-features --features
upac-cli/builtin-all,upac-lib/builtin-all` (the CI "fully static" build)
is clean again

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
earlier refactors

database.rs/orchestrator.rs/scripts_hook.rs imported types from their
pre-refactor locations
(upac_types::{DeclarativeTrigger,FileEntry,FileEntryScope,PackageMeta}
at crate root instead of their actual submodules; ProgressEventBuilder
from upac_abi::hook instead of upac_types::hook;
scripts::load::load_hooks instead of scripts::load_hooks).
plugin_boot_error.rs asserted a BootPluginError::AmbiguousClaim variant
that no longer exists. plugin_boot_manifest.rs and half of
plugin_decoder.rs tested
load_boot_plugin_manifests/load_decoder_manifests as
directory+extension-parameterized free functions — both are now
BootPluginManifests::new()/DecoderManifests::new(), which read
unconditionally from a hardcoded lib.toml-configured path with no way to
inject a test directory, so that style of test isn't reconstructible;
plugin_boot_manifest.rs is deleted and plugin_decoder.rs keeps only its
still-valid build_trigger_table coverage. `cargo test -p upac-lib
--all-targets` is green

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
converted tests to use inline definitions within the module, following
convention
fix: removed the unnecessary CLI structure and replaced it with an enum
fix: renamed folders to use single-word names
new: now can build composefs-setup-root bin as command

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant