1179 |
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
1180 |
[[ ${VERBOSE} = off ]] && opt="--quiet" |
[[ ${VERBOSE} = off ]] && opt="--quiet" |
1181 |
wget \ |
wget \ |
1182 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
1183 |
--directory-prefix=${PKGDIR} \ |
--directory-prefix=${PKGDIR} \ |
1184 |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
1185 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1222 |
# clean up backup files (foo~) |
# clean up backup files (foo~) |
1223 |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
1224 |
|
|
1225 |
# check if an newer mage version is available |
# check if a newer mage version is available |
1226 |
is_newer_mage_version_available |
is_newer_mage_version_available |
1227 |
} |
} |
1228 |
|
|
1229 |
syncmage_tarball() |
syncmage_tarball() |
1230 |
{ |
{ |
1231 |
local latest_tarball |
local latest_tarball |
1232 |
|
local latest_md5 |
1233 |
local temp="$(mktemp -d)" |
local temp="$(mktemp -d)" |
1234 |
local mirr mymirr |
local mirr mymirr |
1235 |
|
|
1236 |
|
# try to get the md5 marked as latest on the server |
1237 |
|
latest_md5="mage-latest.md5" |
1238 |
|
|
1239 |
# try to get the tarball marked as latest on the server |
# try to get the tarball marked as latest on the server |
1240 |
latest_tarball="mage-latest.tar.bz2" |
latest_tarball="mage-latest.tar.bz2" |
1241 |
|
|
1245 |
mymirr="${mirr%/*}" |
mymirr="${mirr%/*}" |
1246 |
|
|
1247 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1248 |
echo "fetching latest tarball from ${mymirr} ..." |
echo "fetching latest md5 from ${mymirr} ..." |
1249 |
|
wget \ |
1250 |
|
${WGET_FETCH_OPTIONS} \ |
1251 |
|
--directory-prefix=${temp} \ |
1252 |
|
${mymirr}/rsync/tarballs/${latest_md5} |
1253 |
|
|
1254 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1255 |
|
echo "fetching latest tarball from ${mymirr} ..." |
1256 |
wget \ |
wget \ |
1257 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
1258 |
--directory-prefix=${temp} \ |
--directory-prefix=${temp} \ |
1259 |
${mymirr}/rsync/tarballs/${latest_tarball} |
${mymirr}/rsync/tarballs/${latest_tarball} |
1260 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1267 |
|
|
1268 |
if [[ -f ${temp}/${latest_tarball} ]] |
if [[ -f ${temp}/${latest_tarball} ]] |
1269 |
then |
then |
1270 |
|
# check md5 |
1271 |
|
if [[ ! -f ${temp}/${latest_md5} ]] |
1272 |
|
then |
1273 |
|
die "md5 is missing ... aborting" |
1274 |
|
else |
1275 |
|
( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed" |
1276 |
|
fi |
1277 |
|
|
1278 |
if [[ -d ${MAGEDIR} ]] |
if [[ -d ${MAGEDIR} ]] |
1279 |
then |
then |
1280 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1290 |
if [[ -d ${temp} ]] |
if [[ -d ${temp} ]] |
1291 |
then |
then |
1292 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1293 |
echo "clenaing temp-files ..." |
echo "cleaning temp-files ..." |
1294 |
rm -rf ${temp} |
rm -rf ${temp} |
1295 |
fi |
fi |
1296 |
|
|
1297 |
|
# check if a newer mage version is available |
1298 |
|
is_newer_mage_version_available |
1299 |
else |
else |
1300 |
die "Could not fetch the latest tarball ... aborting" |
die "Could not fetch the latest tarball ... aborting" |
1301 |
fi |
fi |