diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-12-25 19:33:15 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-12-25 19:33:15 +0100 |
commit | 0eced0a12c76597bb1900be0b420996eeaeff679 (patch) | |
tree | c45dafb694fbb4f226672ae7929c51f4a6c87e93 /src/main.rs | |
parent | 0e09f61377fa8dd9f2476e92d1eaefe0e68bccba (diff) |
copy squashfs tempfile back into the partition
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 2388166..9c698f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -202,9 +202,9 @@ fn write_root(partition: &mut StreamSlice<File>) -> anyhow::Result<()> { let mut partition_buf = Vec::new(); partition.read_to_end(&mut partition_buf)?; - let tmp_file = temp_file::with_contents(&partition_buf); + let tmp_path = temp_file::with_contents(&partition_buf); - let mut writer = SqsWriter::open(tmp_file.path())?; + let mut writer = SqsWriter::open(tmp_path.path())?; let init_file = File::open("init")?; writer.add(SqsSource { @@ -219,6 +219,13 @@ fn write_root(partition: &mut StreamSlice<File>) -> anyhow::Result<()> { writer.finish()?; + let mut tmp_file = File::open(tmp_path.path())?; + let mut tmp_buf = Vec::new(); + + tmp_file.read_to_end(&mut tmp_buf)?; + partition.seek(SeekFrom::Start(0))?; + partition.write_all(&tmp_buf)?; + println!("Root filesystem created successfully"); Ok(()) } |