aboutsummaryrefslogtreecommitdiffstats
path: root/download.sh
blob: 0a4fd9fb0eda9702997561947c9d2980c58e9d39 (plain)
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
#!/bin/bash

# Packages
cat packages.csv patches.csv | while read line; do
    NAME="$(echo $line | cut -d\, -f1)"
    VERSION="$(echo $line | cut -d\, -f2)"
    URL="$(echo $line | cut -d\, -f3 | sed "s/@/${VERSION}/g")"
    MD5SUM="$(echo $line | cut -d\, -f4)"
    CACHEFILE="$(basename "${URL}")"

    if [ ! -f "${CACHEFILE}" ]; then


        echo -ne "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
        wget -nc -q -O "${LFS_SRC}/${CACHEFILE}" "${URL}" & pid=$!
        spinner "$pid"
        if ! echo "${MD5SUM} ${LFS_SRC}/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
            rm -f "${LFS_SRC}/${CACHEFILE}"
            echo -e "\n${GRN}Verification of ${YLW}${CACHEFILE} ${RED}failed! MD5 mismatch!${RST}"
            exit 1
        fi

        echo -e "${GRN}OK${RST}"
    fi
done

# Patches