Skip to content

Commit

Permalink
Don't overwrite already-copied files on install
Browse files Browse the repository at this point in the history
Fixes NixOS#6679 and all issues that contain
`cp: cannot overwrite directory ... with non-directory` errors.
These were caused by 475fc10 and
bb0c4b9. Or rather, installations after
475fc10 erroneously followed and deep-copied symlinks, which was fixed
in bb0c4b9. This meant installations installed with the installer
released between these commits had some paths in their nix store with
directories where symlinks should have been, causing the fixed installer
to try to overwrite them with symlinks.

The -n will not overwrite existing files, which is fine inside of the
nix-store as identical store paths will have identical content.

For additional details and examples, see
NixOS#7603 (comment)
  • Loading branch information
iFreilicht committed Jun 20, 2023
1 parent 6a74e88 commit 1a21b4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/install-multi-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ install_from_extracted_nix() {
cd "$EXTRACTED_NIX_PATH"

_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
cp -RPp ./store/* "$NIX_ROOT/store/"
cp -RPnp ./store/* "$NIX_ROOT/store/"

_sudo "to make the new store non-writable at $NIX_ROOT/store" \
chmod -R ugo-w "$NIX_ROOT/store/"
Expand Down

0 comments on commit 1a21b4c

Please sign in to comment.