summaryrefslogtreecommitdiff
path: root/hel/recv-media.nix
blob: 10f9397d09b786a19ac621c6e1813ad0e37a052d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ stdenv, coreutils, writeScriptBin }:

writeScriptBin "recv-media" ''
  #!${stdenv.shell}

  [[ -z "$1" || -z "$2" ]] && exit 2

  PATH=${coreutils}/bin

  dir=/var/media
  target="''${dir}"/$(basename "$1")

  cp -ln "$1" "''${target}"
  touch -c -t "$2" "''${target}"
''