From b2cd8986d032369736f77e46b039e6be3f5bc2be Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 8 Aug 2023 01:34:55 +0200 Subject: [PATCH] fix: bootpkg only as root --- bootpkg/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bootpkg/src/main.rs b/bootpkg/src/main.rs index ffd4338..65037f3 100644 --- a/bootpkg/src/main.rs +++ b/bootpkg/src/main.rs @@ -15,6 +15,14 @@ mod args; mod prelude; fn main() { + #[cfg(not(debug_assertions))] + { + if unsafe { libc::getuid() } != 0 { + println!("bootpkg must be run as root."); + std::process::exit(1); + } + } + let args = Args::from(env::args().collect::>()[1..].to_owned()); match args.command { Command::Strap => {