python312Packages.vdf: avoid using pname for src.repo
[NixPkgs.git] / pkgs / stdenv / freebsd / unpack-source.sh
blobaa5e89f05c2dbd616e2fa66619a78a230a97c674
1 unpackCmdHooks+=(_FreeBSDUnpackSource)
3 _FreeBSDUnpackSource() {
4 local fn="$1"
5 local destination
7 if [ -d "$fn" ]; then
9 destination="$(stripHash "$fn")"
11 if [ -e "$destination" ]; then
12 echo "Cannot copy $fn to $destination: destination already exists!"
13 echo "Did you specify two \"srcs\" with the same \"name\"?"
14 return 1
17 # We can't preserve hardlinks because they may have been
18 # introduced by store optimization, which might break things
19 # in the build.
20 bsdcp -a -- "$fn" "$destination"
21 chmod -R +w "$destination"
23 else
25 case "$fn" in
26 *.tar.xz | *.tar.lzma | *.txz)
27 # Don't rely on tar knowing about .xz.
28 xz -d < "$fn" | tar xf - --warning=no-timestamp
30 *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
31 # GNU tar can automatically select the decompression method
32 # (info "(tar) gzip").
33 tar xf "$fn" --warning=no-timestamp
36 return 1
38 esac