finding grubenv

main
Zynh0722 2024-05-15 03:42:57 -07:00
parent a605346c8a
commit 7e2b76e125
2 changed files with 20 additions and 1 deletions

7
Cargo.lock generated Normal file
View File

@ -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"

View File

@ -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:?}");
}