Skip to content

multi-user-installer: restore copy-to-store idempotence? #6679

@abathur

Description

@abathur

Before #5150, this section of the multi-user installer used rsync and was (IIRC) ~idempotent:

install_from_extracted_nix() {
task "Installing 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/"
_sudo "to make the new store non-writable at $NIX_ROOT/store" \
chmod -R ugo-w "$NIX_ROOT/store/"

Dropping the rsync dependency to support debian makes sense, but it would be nice to figure out whether we can portably make this step idempotent again--and do it, if it's simple enough.

Shooting from the hip:

  • this might be as simple as using cp's -f flag, if it's portable?
  • it's probably not as simple as just ignoring the exit code from cp, since there could be other issues
  • it's probably not as simple as just diffing the directories, since an existing store will contain more than the store seed

(If we can't do this without, say, wiping the store or restoring the rsync dependency, we should probably figure out how to fail faster until we can find another approach.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions