sudo: add confirmation prompt
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
de8f54ead2
commit
63fc603f07
1 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
|
@ -25,5 +26,21 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
environment.shellAliases = {
|
||||
# Sudo confirmation prompt
|
||||
sudo = pkgs.writeShellScript "sudo" ''
|
||||
read -p "Execute as root? [Y/n] "
|
||||
|
||||
case "$REPLY" in
|
||||
"" | [Yy])
|
||||
command sudo "$@"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue