about summary refs log blame commit diff
path: root/corepkgs/channels/unpack.sh.in
blob: 6e5939f4f21be47e189bc7dbf6ce3cd22d6e6eb9 (plain) (tree)
1
2
3
4
5
6
7
8
9

             


                                                                 

                          

           



                                            
    
                                         
    
                                             
 



                                                       
        

                                                     

                                 
                             


                                            

    
     
                     
#! @shell@ -e

# Cygwin compatibility hack: bunzip2 expects cygwin.dll in $PATH.
export PATH=@coreutils@

@coreutils@/mkdir $out
@coreutils@/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="$(@coreutils@/cat */channel-name)"
    fi

    nr=1
    attrName=$(echo $channelName | @tr@ -- '- ' '__')
    dirName=$attrName
    while test -e ../$dirName; do
        nr=$((nr+1))
        dirName=$attrName-$nr
    done

    @coreutils@/mv * ../$dirName # !!! hacky
done

cd ..
@coreutils@/rmdir tmp