diff --git a/src/bin/installer_tui.rs b/src/bin/installer_tui.rs index 91987e662c..ebe304b191 100644 --- a/src/bin/installer_tui.rs +++ b/src/bin/installer_tui.rs @@ -305,6 +305,7 @@ fn main() { bootloader_efi: &bootloader_efi, password_opt: password_opt.as_ref().map(|x| x.as_bytes()), efi_partition_size: None, + skip_partitions: false, // TODO? }; let res = with_whole_disk(&disk_path, &disk_option, |mount_path| -> Result<()> { let mut config: Config = Config::from_file(&root_path.join("filesystem.toml"))?; diff --git a/src/config/general.rs b/src/config/general.rs index c50d48fadb..b5c736b805 100644 --- a/src/config/general.rs +++ b/src/config/general.rs @@ -5,6 +5,7 @@ pub struct GeneralConfig { pub repo_binary: Option, pub filesystem_size: Option, //MiB pub efi_partition_size: Option, //MiB + pub skip_partitions: Option, } impl GeneralConfig { @@ -13,5 +14,6 @@ impl GeneralConfig { self.repo_binary = other.repo_binary.or(self.repo_binary); self.filesystem_size = other.filesystem_size.or(self.filesystem_size); self.efi_partition_size = other.efi_partition_size.or(self.efi_partition_size); + self.skip_partitions = other.skip_partitions.or(self.skip_partitions); } } diff --git a/src/lib.rs b/src/lib.rs index 1c6b5366c3..0145225d6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,7 @@ pub struct DiskOption<'a> { pub bootloader_efi: &'a [u8], pub password_opt: Option<&'a [u8]>, pub efi_partition_size: Option, //MiB + pub skip_partitions: bool, } fn get_target() -> String { @@ -539,12 +540,24 @@ where bail!("target '{target}' not supported"); } }; - // Open disk and read metadata eprintln!("Opening disk {}", disk_path.as_ref().display()); let mut disk_file = DiskWrapper::open(disk_path.as_ref())?; let disk_size = disk_file.size(); let block_size = disk_file.block_size() as u64; + + if disk_option.skip_partitions { + return with_redoxfs( + DiskIo(fscommon::StreamSlice::new( + disk_file, + 0, + disk_size.next_multiple_of(block_size), + )?), + disk_option.password_opt, + callback, + ); + } + let gpt_block_size = match block_size { 512 => gpt::disk::LogicalBlockSize::Lb512, _ => { @@ -711,6 +724,7 @@ fn install_inner(config: Config, output: &Path, cookbook: Option<&str>, live: bo bootloader_efi: &bootloader_efi, password_opt: None, efi_partition_size: config.general.efi_partition_size, + skip_partitions: config.general.skip_partitions.unwrap_or(false), }; with_whole_disk(output, &disk_option, move |mount_path| { install_dir(config, mount_path, cookbook)