aboutsummaryrefslogtreecommitdiffstats
path: root/download.sh
blob: fff69f7fa9d24097c3471b1c2efee509f44c122d (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
28
#!/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}"
	else
		printf "%b" "${PRP}File cached ${YLW}${CACHEFILE}${RST}... "
	fi

	if ! echo "${MD5SUM} ${LFS}/sources/${CACHEFILE}" | md5sum -c > /dev/null 2>&1; then
		rm -f "${LFS}/sources/${CACHEFILE}"
		printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM} "
		fail "FAILED! MD5 MISMATCH!"
		exit 1
    fi
		printf "%b" "\n${IPRP}     MD5SUM ${YLW}${MD5SUM} "
		success "OK"

done