diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2019-02-13T10·28+0100 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2019-02-20T08·35+0100 |
commit | b9567aa8b6f935522d1037377e0e5205a7529fd8 (patch) | |
tree | 4282830a1784a566406709ae6c75781fa4a86bc9 /scripts/install-multi-user.sh | |
parent | e58a71442ad4a538b48fc7a9938c3690628c4741 (diff) |
install script: don't abort when "nix-channel --update" fails
Instead, print a message about what happened and tell the user what can be done (run "[sudo -i] nix-channel --update nixpkgs" again at a later time). This change allows installing Nix when you're offline. Since the multi-user installer is so verbose, the message isn't printed until the end. Fixes issue #2650 ("installation without internet connection").
Diffstat (limited to 'scripts/install-multi-user.sh')
-rw-r--r-- | scripts/install-multi-user.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index 6ee8dd48582e..3d2acaac82f5 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -240,10 +240,16 @@ EOF } trap finish_fail EXIT +channel_update_failed=0 function finish_success { finish_cleanup ok "Alright! We're done!" + if [ "x$channel_update_failed" = x1 ]; then + echo "" + echo "But fetching the nixpkgs channel failed. (Are you offline?)" + echo "To try again later, run \"sudo -i nix-channel --update nixpkgs\"." + fi cat <<EOF Before Nix will work in your existing shells, you'll need to close @@ -737,7 +743,9 @@ setup_default_profile() { # otherwise it will be lost in environments where sudo doesn't pass # all the environment variables by default. _sudo "to update the default channel in the default profile" \ - HOME="$ROOT_HOME" NIX_SSL_CERT_FILE="$NIX_SSL_CERT_FILE" "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs + HOME="$ROOT_HOME" NIX_SSL_CERT_FILE="$NIX_SSL_CERT_FILE" "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs \ + || channel_update_failed=1 + } |