aboutsummaryrefslogtreecommitdiffstats
path: root/download.sh
blob: 2cec4384f9e211b8e8a2a1d0aa5b39d61b21538a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# Downlod Packages and Patches

cat packages.csv patches.csv | while read -r 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


        printf "%b" "${PRP}Downloading ${YLW}${CACHEFILE}${RST}... "
		download "${URL}"
		if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
            rm -f "${LFS}/sources/${CACHEFILE}"
            printf "%b" "${GRN}Verification of ${YLW}${CACHEFILE} ${RED}FAILED! MD5 MISMATCH!${RST}\n"
            exit 1
        fi
    fi
done