Prompt for sudo before validating assumptions, and check ourselves for root-owned files instead of making a scary warning.

This commit is contained in:
Graham Christensen 2017-07-09 21:25:36 -04:00
parent 3ebd25a644
commit 262a08c0e2
No known key found for this signature in database
GPG key ID: 06121D366FE9435C

View file

@ -366,30 +366,15 @@ EOF
fi fi
done done
warning <<EOF danger_paths=("$ROOT_HOME/.nix-defexpr" "$ROOT_HOME/.nix-channels" "$ROOT_HOME/.nix-profile")
I strongly recommend deleting all the following files, which are for danger_path in "${danger_paths[@]}"; do
relics of a previous installation. You can check by running (yourself): if _sudo "foo"; then
failure <<EOF
$ sudo find / -name .nix-profile -o -name .nix-defexpr -o -name .nix-channels -o -name '*nix-daemon.plist' I found a file at $danger_path, which is a relic of a previous
installation. You must first delete this file before continuing.
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 EOF
fi
if ui_confirm "Does $ROOT_HOME/.nix-defexpr or $ROOT_HOME/.nix-channels or $ROOT_HOME/.nix-profile exist?"; then done
failure <<EOF
You must delete $ROOT_HOME/.nix-defexpr and $ROOT_HOME/.nix-channels
before continuing.
EOF
fi
} }
setup_report() { setup_report() {
@ -566,6 +551,8 @@ EOF
We're going to use sudo to set up Nix: 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 local users (see the list above for the users we'll make)
- create a local group ($NIX_BUILD_GROUP_NAME) - create a local group ($NIX_BUILD_GROUP_NAME)
- install Nix in to $NIX_ROOT - install Nix in to $NIX_ROOT
@ -703,6 +690,9 @@ configure_nix_daemon_plist() {
main() { main() {
chat_about_sudo
if [ "${PINCH_ME_IM_SILLY:-}" = "" ]; then if [ "${PINCH_ME_IM_SILLY:-}" = "" ]; then
validate_starting_assumptions validate_starting_assumptions
fi fi
@ -716,8 +706,6 @@ main() {
exit 1 exit 1
fi fi
chat_about_sudo
create_build_group create_build_group
create_build_users create_build_users
create_directories create_directories