mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Don't prompt about using sudo if we're already root
This commit is contained in:
parent
88a0f3b6ba
commit
7bb1e913b3
2 changed files with 14 additions and 17 deletions
|
@ -337,10 +337,15 @@ __sudo() {
|
|||
_sudo() {
|
||||
local expl="$1"
|
||||
shift
|
||||
if ! headless; then
|
||||
if ! headless || is_root; then
|
||||
__sudo "$expl" "$*" >&2
|
||||
fi
|
||||
sudo "$@"
|
||||
|
||||
if is_root; then
|
||||
env "$@"
|
||||
else
|
||||
sudo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -891,17 +896,6 @@ EOF
|
|||
|
||||
|
||||
main() {
|
||||
# TODO: I've moved this out of validate_starting_assumptions so we
|
||||
# can fail faster in this case. Sourcing install-darwin... now runs
|
||||
# `touch /` to detect Read-only root, but it could update times on
|
||||
# pre-Catalina macOS if run as root user.
|
||||
if is_root; then
|
||||
failure <<EOF
|
||||
Please do not run this script with root privileges. I will call sudo
|
||||
when I need to.
|
||||
EOF
|
||||
fi
|
||||
|
||||
check_selinux
|
||||
|
||||
if is_os_darwin; then
|
||||
|
@ -915,7 +909,10 @@ EOF
|
|||
fi
|
||||
|
||||
welcome_to_nix
|
||||
chat_about_sudo
|
||||
|
||||
if ! is_root; then
|
||||
chat_about_sudo
|
||||
fi
|
||||
|
||||
cure_artifacts
|
||||
# TODO: there's a tension between cure and validate. I moved the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue