about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2017-07-10T01·25-0400
committerGraham Christensen <graham@grahamc.com>2017-07-14T16·10-0400
commit6f639943c288a956a717a353a04f8e03442106c4 (patch)
tree379bb23ac7012d9e0919a892e6078949b5248bfc /scripts
parent2b5ab03524cb0a48757bb5fd86fe584f4d2c8f36 (diff)
Prompt for sudo before validating assumptions, and check ourselves for root-owned files instead of making a scary warning.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install-darwin-multi-user.sh38
1 files changed, 13 insertions, 25 deletions
diff --git a/scripts/install-darwin-multi-user.sh b/scripts/install-darwin-multi-user.sh
index 96728e987765..30e5dec66678 100644
--- a/scripts/install-darwin-multi-user.sh
+++ b/scripts/install-darwin-multi-user.sh
@@ -366,30 +366,15 @@ EOF
         fi
     done
 
-    warning <<EOF
-I strongly recommend deleting all the following files, which are
-relics of a previous installation. You can check by running (yourself):
-
-  $ sudo find / -name .nix-profile  -o -name .nix-defexpr -o -name .nix-channels -o -name '*nix-daemon.plist'
-
-In particular, the following files and directories MUST NOT EXIST!
-
- - $ROOT_HOME/.nix-profile
- - $ROOT_HOME/.nix-defexpr
- - $ROOT_HOME/.nix-channels
-
-If some relics are found and you want to keep them, it might be okay.
-If you're not sure, don't hesitate to ask for help.
-
-$(contactme)
-EOF
-
-    if ui_confirm "Does $ROOT_HOME/.nix-defexpr or $ROOT_HOME/.nix-channels or $ROOT_HOME/.nix-profile exist?"; then
-        failure <<EOF
-You must delete $ROOT_HOME/.nix-defexpr and $ROOT_HOME/.nix-channels
-before continuing.
+    danger_paths=("$ROOT_HOME/.nix-defexpr" "$ROOT_HOME/.nix-channels" "$ROOT_HOME/.nix-profile")
+    for danger_path in "${danger_paths[@]}"; do
+        if _sudo "foo"; then
+            failure <<EOF
+I found a file at $danger_path, which is a relic of a previous
+installation. You must first delete this file before continuing.
 EOF
-    fi
+        fi
+    done
 }
 
 setup_report() {
@@ -566,6 +551,8 @@ EOF
 
 We're going to use sudo to set up Nix:
 
+ - make sure your computer doesn't already have Nix files
+   (if it does, I  will tell you how to clean them up.)
  - create local users (see the list above for the users we'll make)
  - create a local group ($NIX_BUILD_GROUP_NAME)
  - install Nix in to $NIX_ROOT
@@ -703,6 +690,9 @@ configure_nix_daemon_plist() {
 
 
 main() {
+
+    chat_about_sudo
+
     if [ "${PINCH_ME_IM_SILLY:-}" = "" ]; then
         validate_starting_assumptions
     fi
@@ -716,8 +706,6 @@ main() {
         exit 1
     fi
 
-    chat_about_sudo
-
     create_build_group
     create_build_users
     create_directories