summaryrefslogtreecommitdiff
path: root/hel/recv-media.nix
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-09-30 20:00:13 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-09-30 20:00:13 +0200
commite569c673e8b79b1805b290cdef8c557c511f42d1 (patch)
treed4997eb362efa635553da9d9e3fd024e67945131 /hel/recv-media.nix
parentf259d5a3c795bb4d99f43386bc66801facebde5b (diff)
downloadnixos-e569c673e8b79b1805b290cdef8c557c511f42d1.tar
nixos-e569c673e8b79b1805b290cdef8c557c511f42d1.tar.gz
nixos-e569c673e8b79b1805b290cdef8c557c511f42d1.tar.bz2
nixos-e569c673e8b79b1805b290cdef8c557c511f42d1.tar.xz
nixos-e569c673e8b79b1805b290cdef8c557c511f42d1.zip
temporary directory instead of file
Diffstat (limited to 'hel/recv-media.nix')
-rw-r--r--hel/recv-media.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/hel/recv-media.nix b/hel/recv-media.nix
index 67dded55..0be20d0c 100644
--- a/hel/recv-media.nix
+++ b/hel/recv-media.nix
@@ -13,8 +13,10 @@ writeScriptBin "recv-media" ''
13 PATH=${coreutils}/bin 13 PATH=${coreutils}/bin
14 14
15 dir=/var/media 15 dir=/var/media
16 tmpFile="''${dir}"/.tmp/$(basename "$1")
16 target="''${dir}"/$(basename "$1") 17 target="''${dir}"/$(basename "$1")
17 tmpFile=$(${coreutils}/bin/mktemp --dry-run --tmpdir=''${dir} .recv-media.XXXXXXXXXX) 18
19 mkdir -pv $(basename "''${tmpFile}")
18 20
19 ${eject}/bin/ionice -c 3 -t cp -vn --preserve=all "$1" ''${tmpFile} && mv -v ''${tmpFile} "''${target}" 21 ${eject}/bin/ionice -c 3 -t cp -vn --preserve=all "$1" ''${tmpFile} && mv -v ''${tmpFile} "''${target}"
20 touch -c -m -t "$2" "''${target}" 22 touch -c -m -t "$2" "''${target}"