summaryrefslogtreecommitdiff
path: root/fetch-sources.sh
blob: 6d700ea5a41de358574695ddbd67eab747f33491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh -e
mkdir -p sources
cd sources
cat ../sources.list | while read line; do
    HASH=$(echo $line | cut -d"," -f1)
    URL=$(echo $line | cut -d"," -f2)
    CANONICAL=$(echo $line | cut -d"," -f3)
    if [ -z "$CANONICAL" ]; then
        OUTPUT=$(basename $URL)
    else
        OUTPUT=$CANONICAL
    fi
    if [ ! -f "$OUTPUT" ]; then
        echo $OUTPUT
        curl -L $URL -o $OUTPUT
    fi
    echo "$HASH  $OUTPUT" | sha256sum -c -
done