1472 |
local list="$@" |
local list="$@" |
1473 |
local pkgname |
local pkgname |
1474 |
local pkgfile |
local pkgfile |
1475 |
|
local pcat |
1476 |
|
local pname |
1477 |
local mirr |
local mirr |
1478 |
local magefile |
local magefile |
1479 |
local md5file |
local md5file |
1481 |
local count_current |
local count_current |
1482 |
local count_total |
local count_total |
1483 |
local wget_opts |
local wget_opts |
1484 |
|
local fetching |
1485 |
|
|
1486 |
[ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}." |
[ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}." |
1487 |
|
|
1500 |
pkgfile="${pkgname}.${PKGSUFFIX}" |
pkgfile="${pkgname}.${PKGSUFFIX}" |
1501 |
pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" |
pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" |
1502 |
|
|
1503 |
|
pcat=$(magename2pcat ${magefile}) |
1504 |
|
pname=$(magename2pname ${magefile}) |
1505 |
|
md5file="${MAGEDIR}/${pcat}/${pname}/md5/${pkgname}.md5" |
1506 |
|
|
1507 |
(( count_current++ )) |
(( count_current++ )) |
1508 |
xtitle "[ (${count_current}/${count_total}) Fetching ${pkgfile} ]" |
xtitle "[ (${count_current}/${count_total}) Fetching ${pkgfile} ]" |
1509 |
|
|
1523 |
continue |
continue |
1524 |
fi |
fi |
1525 |
|
|
1526 |
# abort if already exist |
# check if FETCHING is required |
1527 |
if [ -f ${PKGDIR}/${pkgfile} ] |
if [ ! -f "${md5file}" ] |
1528 |
|
then |
1529 |
|
fetching=true |
1530 |
|
else |
1531 |
|
if mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 &> /dev/null |
1532 |
|
then |
1533 |
|
# md5's ok, no fetching required |
1534 |
|
fetching=false |
1535 |
|
else |
1536 |
|
fetching=true |
1537 |
|
fi |
1538 |
|
fi |
1539 |
|
|
1540 |
|
if [[ ${fetching} = false ]] |
1541 |
then |
then |
1542 |
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
1543 |
echo " fetch complete (${count_current}/${count_total}): ${pkgfile} ... " |
echo " fetch complete (${count_current}/${count_total}): ${pkgfile} ... " |
1544 |
continue |
continue |
1545 |
|
else |
1546 |
|
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
1547 |
|
echo -e " fetching (${count_current}/${count_total}): ${pkgfile} ... " |
1548 |
|
mdownload --uri "package://${pkgfile}" --dir "${PKGDIR}" || die "Could not download ${pkgfile}" |
1549 |
fi |
fi |
1550 |
|
|
1551 |
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
# sanity check, not really needed but to be sure |
|
echo -e " fetching (${count_current}/${count_total}): ${pkgfile} ... " |
|
|
mdownload --uri "package://${pkgfile}" --dir "${PKGDIR}" || die "Could not download ${pkgfile}" |
|
1552 |
if [ ! -f ${PKGDIR}/${pkgfile} ] |
if [ ! -f ${PKGDIR}/${pkgfile} ] |
1553 |
then |
then |
1554 |
die "Package '${pkgfile}' after download not found in '${PKGDIR}'" |
die "Package '${pkgfile}' after download not found in '${PKGDIR}'" |