Skip to content

Commit eb65960

Browse files
Accept review suggestions from PR #301
Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
1 parent f9033f8 commit eb65960

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ impl BiosBoot {
3737
}
3838

3939
/// Add a ramdisk file to the image
40-
pub fn with_ramdisk(&self, ramdisk_path: &Path) -> Self {
41-
Self {
42-
kernel: self.kernel.to_owned(),
43-
ramdisk: Some(ramdisk_path.to_owned()),
44-
}
40+
pub fn set_ramdisk(&mut self, ramdisk_path: &Path) -> &mut Self {
41+
self.ramdisk = Some(ramdisk_path.to_owned());
42+
self
4543
}
4644

4745
/// Create a bootable UEFI disk image at the given path.
@@ -81,7 +79,7 @@ impl BiosBoot {
8179
files.insert(KERNEL_FILE_NAME, kernel_path);
8280
files.insert(BIOS_STAGE_3, stage_3_path);
8381
files.insert(BIOS_STAGE_4, stage_4_path);
84-
if has_rd_path {
82+
if let Some(ramdisk_path) = &self.ramdisk {
8583
files.insert(RAMDISK_FILE_NAME, ramdisk_path);
8684
}
8785
let out_file = NamedTempFile::new().context("failed to create temp file")?;

0 commit comments

Comments
 (0)