From 7e2b76e125714394457eeedb9f49dbed22977f03 Mon Sep 17 00:00:00 2001 From: Zynh0722 Date: Wed, 15 May 2024 03:42:57 -0700 Subject: [PATCH] finding grubenv --- Cargo.lock | 7 +++++++ src/main.rs | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..14cc51d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "grub-reboot-rs" +version = "0.1.0" diff --git a/src/main.rs b/src/main.rs index e7a11a9..f89cf40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,15 @@ +use std::{path::Path, process::exit}; + +const BOOT_PATH: &str = "/boot"; + fn main() { - println!("Hello, world!"); + let boot_folder = Path::new(BOOT_PATH); + let grub_env = boot_folder.join("grub/grubenv"); + + if !grub_env.exists() { + eprintln!("Unable to find grubenv"); + exit(1); + } + + println!("{grub_env:?}"); }