-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement a root check menu * code needs to be readable * rephrase it a lil bit * disregard escalation tool variable if found as root * refactor: Call root check from within AppState constructor (#7) * remove duplicate check * add comment back --------- Co-authored-by: Liam <[email protected]>
- Loading branch information
Showing
6 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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)] | ||
pub fn check_root_status() -> Option<FloatingText> { | ||
(Uid::effective().is_root()).then_some(FloatingText::new( | ||
ROOT_WARNING.into(), | ||
"Root User Warning", | ||
true, | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters