1232 |
syncmage_tarball() |
syncmage_tarball() |
1233 |
{ |
{ |
1234 |
local latest_tarball |
local latest_tarball |
1235 |
|
local latest_md5 |
1236 |
local temp="$(mktemp -d)" |
local temp="$(mktemp -d)" |
1237 |
local mirr mymirr |
local mirr mymirr |
1238 |
|
|
1239 |
|
# try to get the md5 marked as latest on the server |
1240 |
|
latest_md5="mage-latest.md5" |
1241 |
|
|
1242 |
# try to get the tarball marked as latest on the server |
# try to get the tarball marked as latest on the server |
1243 |
latest_tarball="mage-latest.tar.bz2" |
latest_tarball="mage-latest.tar.bz2" |
1244 |
|
|
1248 |
mymirr="${mirr%/*}" |
mymirr="${mirr%/*}" |
1249 |
|
|
1250 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1251 |
|
echo "fetching latest md5 from ${mymirr} ..." |
1252 |
|
wget \ |
1253 |
|
--passive-ftp \ |
1254 |
|
--tries 3 \ |
1255 |
|
--continue \ |
1256 |
|
--progress bar \ |
1257 |
|
--directory-prefix=${temp} \ |
1258 |
|
${mymirr}/rsync/tarballs/${latest_md5} |
1259 |
|
|
1260 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1261 |
echo "fetching latest tarball from ${mymirr} ..." |
echo "fetching latest tarball from ${mymirr} ..." |
1262 |
|
|
1263 |
wget \ |
wget \ |
1277 |
|
|
1278 |
if [[ -f ${temp}/${latest_tarball} ]] |
if [[ -f ${temp}/${latest_tarball} ]] |
1279 |
then |
then |
1280 |
|
# check md5 |
1281 |
|
if [[ ! -f ${temp}/${latest_md5} ]] |
1282 |
|
then |
1283 |
|
die "md5 is missing ... aborting" |
1284 |
|
else |
1285 |
|
( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed" |
1286 |
|
fi |
1287 |
|
|
1288 |
if [[ -d ${MAGEDIR} ]] |
if [[ -d ${MAGEDIR} ]] |
1289 |
then |
then |
1290 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |