From 39d45a6b090b5105423b22b8ef39c2a4a000a4a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Jan 2012 01:51:38 +0000 Subject: * Add a test for nix-channel. * Refactor the nix-channel unpacker a bit. --- corepkgs/unpack-channel.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 corepkgs/unpack-channel.sh (limited to 'corepkgs/unpack-channel.sh') diff --git a/corepkgs/unpack-channel.sh b/corepkgs/unpack-channel.sh new file mode 100644 index 000000000000..7c244a6a8552 --- /dev/null +++ b/corepkgs/unpack-channel.sh @@ -0,0 +1,30 @@ +mkdir $out +mkdir $out/tmp +cd $out/tmp + +inputs=($inputs) +for ((n = 0; n < ${#inputs[*]}; n += 2)); do + channelName=${inputs[n]} + channelTarball=${inputs[n+1]} + + echo "unpacking channel $channelName" + + $bzip2 -d < $channelTarball | $tar xf - + + if test -e */channel-name; then + channelName="$(cat */channel-name)" + fi + + nr=1 + attrName=$(echo $channelName | $tr -- '- ' '__') + dirName=$attrName + while test -e ../$dirName; do + nr=$((nr+1)) + dirName=$attrName-$nr + done + + mv * ../$dirName # !!! hacky +done + +cd .. +rmdir tmp -- cgit 1.4.1