use the factorcode.org checksums when downloading boot images

db4
Doug Coleman 2008-02-13 14:20:37 -06:00
parent 7f48a7b023
commit df1c5b5aba
1 changed files with 20 additions and 6 deletions

View File

@ -83,6 +83,8 @@ check_installed_programs() {
ensure_program_installed wget curl ensure_program_installed wget curl
ensure_program_installed gcc ensure_program_installed gcc
ensure_program_installed make ensure_program_installed make
ensure_program_installed md5sum
ensure_program_installed cut
case $OS in case $OS in
netbsd) ensure_program_installed gmake;; netbsd) ensure_program_installed gmake;;
esac esac
@ -263,14 +265,28 @@ make_factor() {
invoke_make NO_UI=$NO_UI $MAKE_TARGET -j5 invoke_make NO_UI=$NO_UI $MAKE_TARGET -j5
} }
delete_boot_images() { update_boot_images() {
echo "Deleting old images..." echo "Deleting old images..."
rm $BOOT_IMAGE > /dev/null 2>&1 rm checksums.txt* > /dev/null 2>&1
rm $BOOT_IMAGE.* > /dev/null 2>&1 rm $BOOT_IMAGE.* > /dev/null 2>&1
rm staging.*.image > /dev/null 2>&1 rm staging.*.image > /dev/null 2>&1
if [[ -f $BOOT_IMAGE ]] ; then
get_url http://factorcode.org/images/latest/checksums.txt
factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '`;
disk_md5=`md5sum $BOOT_IMAGE|cut -f1 -d' '`;
if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
echo "Your disk boot image matches the one on factorcode.org."
else
rm $BOOT_IMAGE > /dev/null 2>&1
get_boot_image;
fi
else
get_boot_image
fi
} }
get_boot_image() { get_boot_image() {
echo "Downloading boot image $BOOT_IMAGE."
get_url http://factorcode.org/images/latest/$BOOT_IMAGE get_url http://factorcode.org/images/latest/$BOOT_IMAGE
} }
@ -278,7 +294,6 @@ get_url() {
if [[ $DOWNLOAD -eq "" ]] ; then if [[ $DOWNLOAD -eq "" ]] ; then
set_downloader; set_downloader;
fi fi
echo "HI"
echo $DOWNLOAD $1 ; echo $DOWNLOAD $1 ;
$DOWNLOAD $1 $DOWNLOAD $1
check_ret $DOWNLOAD check_ret $DOWNLOAD
@ -329,8 +344,7 @@ update() {
} }
update_bootstrap() { update_bootstrap() {
delete_boot_images update_boot_images
get_boot_image
bootstrap bootstrap
} }
@ -363,6 +377,6 @@ case "$1" in
quick-update) update; refresh_image ;; quick-update) update; refresh_image ;;
update) update; update_bootstrap ;; update) update; update_bootstrap ;;
bootstrap) get_config_info; bootstrap ;; bootstrap) get_config_info; bootstrap ;;
net-bootstrap) get_config_info; delete_boot_images; get_boot_image; bootstrap ;; net-bootstrap) get_config_info; update_boot_images; bootstrap ;;
*) usage ;; *) usage ;;
esac esac