summaryrefslogtreecommitdiff
path: root/hel/recv-media.nix
blob: 505c5df3004b593e44c4b837bc26d160c578e1d2 (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 -m -t "$2" "''${target}"
''