diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-10-12 22:29:38 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-10-12 23:45:30 +0200 |
commit | af38c055876c5155f29a09dcd3714fbb9aff7b18 (patch) | |
tree | 88f7101125bbc8bb8b36666321272d929d2a7f7f /pkgs/stdenv/generic | |
parent | e228c804ada2acbe614e8a4cb5b2105d4b1eed15 (diff) |
stdenv stripHash(): fixup after #19324
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 15238a44598d9..154fdefd789c7 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -490,12 +490,14 @@ dumpVars() { } -# Utility function: return the base name of the given path, with the +# Utility function: echo the base name of the given path, with the # prefix `HASH-' removed, if present. stripHash() { - strippedName=$(basename $1); + local strippedName="$(basename "$1")"; if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then echo "$strippedName" | cut -c34- + else + echo "$strippedName" fi } @@ -506,12 +508,10 @@ _defaultUnpack() { if [ -d "$fn" ]; then - stripHash "$fn" - # We can't preserve hardlinks because they may have been # introduced by store optimization, which might break things # in the build. - cp -pr --reflink=auto "$fn" $strippedName + cp -pr --reflink=auto "$fn" "$(stripHash "$fn")" else |