From cb768c573d11c6d4734718b7362408338102fd96 Mon Sep 17 00:00:00 2001 From: Winter Date: Sat, 10 Dec 2022 19:03:45 -0500 Subject: [PATCH] install-multi-user: chown bootstrap store contents Before this change, the bootstrap store contents would be owned by the user who ran the script. This leads to inconsistencies in store path permissions, and can cause confusing issues for users (an example being zsh's compaudit being fired when attempting to use the completions from the bootstrap copy of Nix). --- scripts/install-multi-user.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index ec82e0560d7..d9b9738b22e 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -810,6 +810,24 @@ install_from_extracted_nix() { _sudo "to make the new store non-writable at $NIX_ROOT/store" \ chmod -R ugo-w "$NIX_ROOT/store/" + # This is copied from create_directories, see it for why we do all this stuff just to find chown. + local get_chr_own="$(PATH="$(getconf PATH 2>/dev/null)" command -vp chown)" + if [[ -z "$get_chr_own" ]]; then + get_chr_own="$(command -v chown)" + fi + + if [[ -z "$get_chr_own" ]]; then + reminder <