Skip to content

Commit

Permalink
feat: add bootc support
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Nov 17, 2024
1 parent 444689c commit 7932ca9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@

# rpm_ostree = false

# bootc = false

# nix_arguments = "--flake"

# nix_env_arguments = "--prebuilt-only"
Expand Down
10 changes: 10 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ pub struct Linux {
redhat_distro_sync: Option<bool>,
suse_dup: Option<bool>,
rpm_ostree: Option<bool>,
bootc: Option<bool>,

#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
emerge_sync_flags: Option<String>,
Expand Down Expand Up @@ -1448,6 +1449,15 @@ impl Config {
.unwrap_or(false)
}

/// Use bootc in *when bootc is detected* (default: false)
pub fn bootc(&self) -> bool {
self.config_file
.linux
.as_ref()
.and_then(|linux| linux.bootc)
.unwrap_or(false)
}

/// Determine if we should ignore failures for this step
pub fn ignore_failure(&self, step: Step) -> bool {
self.config_file
Expand Down
7 changes: 7 additions & 0 deletions src/steps/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ fn upgrade_wolfi_linux(ctx: &ExecutionContext) -> Result<()> {
}

fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
if let Some(bootc) = which("bootc") {
if ctx.config().bootc() {
let sudo = require_option(ctx.sudo().as_ref(), get_require_sudo_string())?;
return ctx.run_type().execute(sudo).arg(&bootc).arg("upgrade").status_checked();
}
};

if let Some(ostree) = which("rpm-ostree") {
if ctx.config().rpm_ostree() {
let mut command = ctx.run_type().execute(ostree);
Expand Down

0 comments on commit 7932ca9

Please sign in to comment.