fix: bootpkg only as root

This commit is contained in:
Didier Slof 2023-08-08 01:34:55 +02:00
parent e2154bda29
commit b2cd8986d0
Signed by: didier
GPG key ID: 01E71F18AA4398E5

View file

@ -15,6 +15,14 @@ mod args;
mod prelude; mod prelude;
fn main() { 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::<Vec<String>>()[1..].to_owned()); let args = Args::from(env::args().collect::<Vec<String>>()[1..].to_owned());
match args.command { match args.command {
Command::Strap => { Command::Strap => {