Backport upstream bugfix to c10s/10.2

Resolves: https://issues.redhat.com/browse/RHEL-135347
This commit is contained in:
yasminvalim 2025-12-15 12:21:38 -03:00 committed by Yasmin de Souza
parent a394b896ca
commit 4da2328f01
3 changed files with 93 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From a5b314f36ef805f6581c408abc4e9607a2f2ad04 Mon Sep 17 00:00:00 2001
From: yasminvalim <ydesouza@redhat.com>
Date: Mon, 13 Oct 2025 10:44:55 -0300
Subject: [PATCH 1/2] install: check if firstboot args are defined and add them
manually if necessary
(cherry picked from commit f43c6ad77841761b5f2386bb670664fe18184efb)
---
src/cmdline/install.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/cmdline/install.rs b/src/cmdline/install.rs
index 885ca73..206d602 100644
--- a/src/cmdline/install.rs
+++ b/src/cmdline/install.rs
@@ -272,7 +272,7 @@ impl InstallConfig {
return Ok(self);
}
- let args = self
+ let mut args = self
.config_file
.iter()
.map(|path| {
@@ -295,6 +295,12 @@ impl InstallConfig {
)
.collect::<Vec<_>>();
+ // If firstboot-args is defined, add it manually
+ if let Some(firstboot_args) = &self.firstboot_args {
+ args.push("--firstboot-args".to_string());
+ args.push(firstboot_args.clone());
+ }
+
println!("Running with arguments: {}", args.join(" "));
Self::from_args(&args)
}
--
2.51.1

View File

@ -0,0 +1,48 @@
From dbf43bbc22bc6f4e873d442ca537e25d2288cb0f Mon Sep 17 00:00:00 2001
From: yasminvalim <ydesouza@redhat.com>
Date: Mon, 13 Oct 2025 11:42:48 -0300
Subject: [PATCH 2/2] install: add unit tests
(cherry picked from commit 26094bf552f5ddf3fec974c1f7e7b468bbe4b9e6)
---
src/cmdline/install.rs | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/cmdline/install.rs b/src/cmdline/install.rs
index 206d602..915db59 100644
--- a/src/cmdline/install.rs
+++ b/src/cmdline/install.rs
@@ -584,4 +584,30 @@ dest-device: u
.expand_config_files()
.unwrap_err();
}
+
+ /// Test that firstboot-args is manually added to args list when defined
+ #[test]
+ fn test_firstboot_args_manually_added() {
+ let mut f = NamedTempFile::new().unwrap();
+ f.as_file_mut().write_all(b"dest-device: /dev/sda").unwrap();
+
+ let config = InstallConfig::from_args(&[
+ "--config-file",
+ f.path().to_str().unwrap(),
+ "--firstboot-args",
+ "ip=dhcp",
+ ])
+ .unwrap();
+
+ // Verify firstboot-args is defined
+ assert!(config.firstboot_args.is_some());
+ assert_eq!(config.firstboot_args.as_ref().unwrap(), "ip=dhcp");
+
+ // Test expand_config_files to verify manual addition
+ let expanded = config.expand_config_files().unwrap();
+
+ // Should still have firstboot-args
+ assert!(expanded.firstboot_args.is_some());
+ assert_eq!(expanded.firstboot_args.unwrap(), "ip=dhcp");
+ }
}
--
2.51.1

View File

@ -12,7 +12,7 @@
Name: rust-%{crate}
Version: 0.25.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Installer for Fedora CoreOS and RHEL CoreOS
# Upstream license specification: Apache-2.0
@ -23,6 +23,10 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{
Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz
Source2: https://github.com/coreos/coreos-installer-dracut/archive/%{dracutcommit}/coreos-installer-dracut-%{dracutshortcommit}.tar.gz
# https://github.com/coreos/coreos-installer/pull/1699
Patch0: 0001-install-check-if-firstboot-args-are-defined-and-add-.patch
Patch1: 0002-install-add-unit-tests.patch
ExclusiveArch: %{rust_arches}
%if 0%{?rhel} && !0%{?eln}
BuildRequires: rust-toolset