diff options
author | Graham Christensen <graham@grahamc.com> | 2022-08-08 15:46:17 -0400 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2022-08-10 09:37:08 -0400 |
commit | 7bb1e913b33499d3ce74929749977774bcc35aed (patch) | |
tree | 1196f0da21fdbb87be2ffb56f1360e254c58318e /scripts | |
parent | 88a0f3b6bace3a17b69dfb799494d78aae0dd71d (diff) |
Don't prompt about using sudo if we're already root
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/install-multi-user.sh | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index 472d25842..e7bdc1227 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -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 |