From 4846c68c4afe640c91440123b7bccb007be5dfbd Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 5 Jul 2016 17:13:42 +0200 Subject: cleanup recv-media --- hel/recv-media.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'hel/recv-media.nix') diff --git a/hel/recv-media.nix b/hel/recv-media.nix index 5994ebea..2ae78e90 100644 --- a/hel/recv-media.nix +++ b/hel/recv-media.nix @@ -3,12 +3,13 @@ writeScriptBin "recv-media" '' #!${stdenv.shell} - [[ -z "$1" ]] && exit 2 + [[ -z "$1" || -z "$2" ]] && exit 2 PATH=${coreutils}/bin dir=/var/media + target="''${dir}"/$(basename "$1") - cp -ln "$1" "''${dir}/$(basename "$1")" - [[ -n "$2" ]] && touch -c -d "$(print "$2" | tr '_' ' ')" "''${dir}/$(basename "$1")" + cp -ln "$1" "''${target}" + touch -c -d "$(print "$2" | tr '_' ' ')" "''${target}" '' -- cgit v1.2.3