Skip to content

Commit 65b9e01

Browse files
authored
Merge pull request #13430 from NixOS/mergify/bp/2.30-maintenance/pr-13427
installers, tests: remove --preserve=mode from cp invocations (backport #13427)
2 parents f7c95fd + 48c7e5e commit 65b9e01

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

scripts/install-multi-user.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,13 @@ install_from_extracted_nix() {
834834
(
835835
cd "$EXTRACTED_NIX_PATH"
836836

837-
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
838-
cp -RPp ./store/* "$NIX_ROOT/store/"
837+
if is_os_darwin; then
838+
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
839+
cp -RPp ./store/* "$NIX_ROOT/store/"
840+
else
841+
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
842+
cp -RP --preserve=ownership,timestamps ./store/* "$NIX_ROOT/store/"
843+
fi
839844

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

scripts/install-nix-from-tarball.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do
167167
rm -rf "$i_tmp"
168168
fi
169169
if ! [ -e "$dest/store/$i" ]; then
170-
cp -RPp "$self/store/$i" "$i_tmp"
170+
if [ "$(uname -s)" = "Darwin" ]; then
171+
cp -RPp "$self/store/$i" "$i_tmp"
172+
else
173+
cp -RP --preserve=ownership,timestamps "$self/store/$i" "$i_tmp"
174+
fi
171175
chmod -R a-w "$i_tmp"
172176
chmod +w "$i_tmp"
173177
mv "$i_tmp" "$dest/store/$i"

tests/nixos/github-flakes.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ let
8181
mkdir -p $out/archive
8282
8383
dir=NixOS-nixpkgs-${nixpkgs.shortRev}
84-
cp -prd ${nixpkgs} $dir
84+
cp -rd --preserve=ownership,timestamps ${nixpkgs} $dir
8585
# Set the correct timestamp in the tarball.
8686
find $dir -print0 | xargs -0 touch -h -t ${builtins.substring 0 12 nixpkgs.lastModifiedDate}.${
8787
builtins.substring 12 2 nixpkgs.lastModifiedDate

tests/nixos/sourcehut-flakes.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ let
4848

4949
nixpkgs-repo = pkgs.runCommand "nixpkgs-flake" { } ''
5050
dir=NixOS-nixpkgs-${nixpkgs.shortRev}
51-
cp -prd ${nixpkgs} $dir
51+
cp -rd --preserve=ownership,timestamps ${nixpkgs} $dir
5252
5353
# Set the correct timestamp in the tarball.
5454
find $dir -print0 | xargs -0 touch -h -t ${builtins.substring 0 12 nixpkgs.lastModifiedDate}.${

tests/nixos/tarball-flakes.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let
1313
1414
set -x
1515
dir=nixpkgs-${nixpkgs.shortRev}
16-
cp -prd ${nixpkgs} $dir
16+
cp -rd --preserve=ownership,timestamps ${nixpkgs} $dir
1717
# Set the correct timestamp in the tarball.
1818
find $dir -print0 | xargs -0 touch -h -t ${builtins.substring 0 12 nixpkgs.lastModifiedDate}.${
1919
builtins.substring 12 2 nixpkgs.lastModifiedDate

0 commit comments

Comments
 (0)