2024-11-11 16:27:30 +00:00
|
|
|
use crate::floating_text::FloatingText;
|
|
|
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
use nix::unistd::Uid;
|
|
|
|
|
|
|
|
const ROOT_WARNING: &str = "WARNING: You are running this utility as root!\n
|
|
|
|
This means you have full system access and commands can potentially damage your system if used incorrectly.\n
|
|
|
|
Please proceed with caution and make sure you understand what each script does before executing it.";
|
|
|
|
|
|
|
|
#[cfg(unix)]
|
2024-11-11 16:53:28 +00:00
|
|
|
pub fn check_root_status<'a>() -> Option<FloatingText<'a>> {
|
2024-11-11 16:27:30 +00:00
|
|
|
(Uid::effective().is_root()).then_some(FloatingText::new(
|
|
|
|
ROOT_WARNING.into(),
|
|
|
|
"Root User Warning",
|
|
|
|
true,
|
|
|
|
))
|
|
|
|
}
|