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

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

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

  PATH=${coreutils}/bin

  dir=/var/media

  cp -ln "$1" "''${dir}/$(basename "$1")"
  [[ -n "$2" ]] && touch -c -d "$(print "$2" | tr '_' ' ')" "''${dir}/$(basename "$1")"
''