aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index c323898..9520ca8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
use anyhow::bail;
use std::env;
-use std::fs::File;
+use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::Path;
use std::process::Command;
@@ -96,6 +96,7 @@ fn main() -> anyhow::Result<()> {
println!("Kernel source unpacked successfully");
+ let current_dir = env::current_dir()?;
env::set_current_dir(file_name.trim_end_matches(".tar.xz"))?;
println!("Compiling kernel...");
@@ -106,5 +107,10 @@ fn main() -> anyhow::Result<()> {
copy_file(kernel_path, "vmlinuz")?;
+ env::set_current_dir(current_dir)?;
+
+ fs::remove_file(file_name)?;
+ fs::remove_file(file_name.trim_end_matches(".tar.xz"))?;
+
Ok(())
}