about summary refs log tree commit diff
path: root/corepkgs/unpack-channel.sh
blob: 7c244a6a855275ee453fbba1e1c94ffd20baee9b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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