aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs30
2 files changed, 30 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b6f8ccd..dfcda8d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,3 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+anyhow = "1.0.68"
+reqwest = { version = "0.11.13", features = ["blocking"] }
diff --git a/src/main.rs b/src/main.rs
index e7a11a9..8048fc2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,29 @@
-fn main() {
- println!("Hello, world!");
+use std::fs::File;
+use std::path::Path;
+
+const LATEST: &str = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.1.tar.xz";
+
+const CONFIG: &str = r#"
+CONFIG_IPV6=y
+"#;
+
+fn download_kernel() -> anyhow::Result<()> {
+ println!("Downloading kernel source...");
+
+ let file_name = Path::new(LATEST).file_name().unwrap().to_str().unwrap();
+
+ let mut file = File::create(file_name)?;
+
+ reqwest::blocking::get(LATEST)?
+ .error_for_status()?
+ .copy_to(&mut file)?;
+
+ println!("Kernel source downloaded successfully");
+ Ok(())
+}
+
+fn main() -> anyhow::Result<()> {
+ download_kernel()?;
+
+ Ok(())
}