diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-01 15:22:25 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-01 15:22:25 +0200 |
commit | 4197878eae358faa2c0db9b6e73b703f88b4c8e7 (patch) | |
tree | 8721e3042a7a2afc7137d84b010db1434f5f04d5 | |
parent | ed20ddc9594b03fcea1c7136ac1acd16abe3e199 (diff) | |
download | nixos-4197878eae358faa2c0db9b6e73b703f88b4c8e7.tar nixos-4197878eae358faa2c0db9b6e73b703f88b4c8e7.tar.gz nixos-4197878eae358faa2c0db9b6e73b703f88b4c8e7.tar.bz2 nixos-4197878eae358faa2c0db9b6e73b703f88b4c8e7.tar.xz nixos-4197878eae358faa2c0db9b6e73b703f88b4c8e7.zip |
always try hardlinking first
-rw-r--r-- | hel/recv-media.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/hel/recv-media.nix b/hel/recv-media.nix index 2c42c5da..e0306b9a 100644 --- a/hel/recv-media.nix +++ b/hel/recv-media.nix | |||
@@ -16,8 +16,10 @@ writeScriptBin "recv-media" '' | |||
16 | tmpFile="''${dir}"/.tmp/$(basename "$1") | 16 | tmpFile="''${dir}"/.tmp/$(basename "$1") |
17 | target="''${dir}"/$(basename "$1") | 17 | target="''${dir}"/$(basename "$1") |
18 | 18 | ||
19 | mkdir -pv $(dirname "''${tmpFile}") | 19 | if ! cp -lnv --preserve=all "$1" "''${target}"; then |
20 | mkdir -pv $(dirname "''${tmpFile}") | ||
20 | 21 | ||
21 | ${eject}/bin/ionice -c 3 -t cp -vn --preserve=all "$1" ''${tmpFile} && mv -v ''${tmpFile} "''${target}" | 22 | ${eject}/bin/ionice -c 3 -t cp -vn --preserve=all "$1" "''${tmpFile}" && mv -v "''${tmpFile}" "''${target}" |
22 | touch -c -m -t "$2" "''${target}" | 23 | touch -c -m -t "$2" "''${target}" |
24 | fi | ||
23 | '' | 25 | '' |