tvl-depot/corepkgs/channels/unpack.sh.in

34 lines
751 B
Bash
Raw Normal View History

#! @shell@ -e
2005-03-15 13:03:15 +01:00
@coreutils@/mkdir $out
@coreutils@/mkdir $out/tmp
cd $out/tmp
expr=$out/default.nix
echo '{' > $expr
inputs=($inputs)
for ((n = 0; n < ${#inputs[*]}; n += 2)); do
channelName=${inputs[n]}
channelTarball=${inputs[n+1]}
echo "unpacking channel $channelName"
@bunzip2@ < $channelTarball | @tar@ xf -
nr=1
dirName=$channelName
while test -e ../$dirName; do
nr=$((nr+1))
dirName=$channelName-$nr
done
@coreutils@/mv * ../$dirName # !!! hacky
attrName=$(echo $dirName | @tr@ -- '- ' '__')
echo "$attrName = let e = import ./$dirName; in if builtins.isFunction e then e {} else e;" >> $expr
done
echo '} // {_combineChannels = true;}' >> $expr
cd ..
2005-03-15 13:03:15 +01:00
@coreutils@/rmdir tmp