unpack-channel.nix: fix 'mv' corner case

unpack-channel.nix fails if the tarball contains a directory named the
same as the channel:

  mv: cannot move 'nixpkgs' to a subdirectory of itself, '.../nixpkgs'

This commit fixes that by not moving the directory if it already has the
correct name.
This commit is contained in:
Bjørn Forsman 2017-02-27 10:09:48 +01:00
parent 89ffe1eff9
commit f72206b736

View file

@ -15,7 +15,9 @@ let
else
${bzip2} -d < $src | ${tar} xf - ${tarFlags}
fi
if [ * != $channelName ]; then
mv * $out/$channelName
fi
if [ -n "$binaryCacheURL" ]; then
mkdir $out/binary-caches
echo -n "$binaryCacheURL" > $out/binary-caches/$channelName