From e630f997d01414b193051663dba2d2d0884b9ba5 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 21 Nov 2011 12:49:19 -0600 Subject: [PATCH] cleanup: factor out the netinstall Signed-off-by: Robert Nelson --- mk_mmc.sh | 89 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/mk_mmc.sh b/mk_mmc.sh index 7202e97..e339323 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -201,6 +201,54 @@ function dl_kernel_image { echo "Using: ${ACTUAL_DEB_FILE}" } +function dl_netinstall_image { + echo "" + echo "Downloading NetInstall Image" + echo "-----------------------------" + +case "$DIST" in + maverick) + TEST_MD5SUM=$MAVERICK_MD5SUM + NETIMAGE=$MAVERICK_NETIMAGE + HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" + BASE_IMAGE="versatile" + ;; + natty) + TEST_MD5SUM=$NATTY_MD5SUM + NETIMAGE=$NATTY_NETIMAGE + HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" + BASE_IMAGE="versatile" + ;; + oneiric) + TEST_MD5SUM=$ONEIRIC_MD5SUM + NETIMAGE=$ONEIRIC_NETIMAGE + HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" + BASE_IMAGE="linaro-vexpress" + ;; + squeeze) + TEST_MD5SUM=$SQUEEZE_MD5SUM + NETIMAGE=$SQUEEZE_NETIMAGE + HTTP_IMAGE="http://ftp.debian.org/debian/dists" + BASE_IMAGE="versatile" + ;; +esac + + if ls ${DIR}/dl/${DIST}/initrd.gz >/dev/null 2>&1;then + MD5SUM=$(md5sum ${DIR}/dl/${DIST}/initrd.gz | awk '{print $1}') + if [ "=$TEST_MD5SUM=" != "=$MD5SUM=" ]; then + echo "Note: md5sum has changed: $MD5SUM" + echo "-----------------------------" + rm -f ${DIR}/dl/${DIST}/initrd.gz || true + wget --directory-prefix=${DIR}/dl/${DIST} ${HTTP_IMAGE}/${DIST}/main/installer-armel/${NETIMAGE}/images/${BASE_IMAGE}/netboot/initrd.gz + NEW_MD5SUM=$(md5sum ${DIR}/dl/${DIST}/initrd.gz | awk '{print $1}') + echo "Note: new md5sum $NEW_MD5SUM" + echo "-----------------------------" + fi + else + wget --directory-prefix=${DIR}/dl/${DIST} ${HTTP_IMAGE}/${DIST}/main/installer-armel/${NETIMAGE}/images/${BASE_IMAGE}/netboot/initrd.gz + fi +} + function boot_files_template { mkdir -p ${TEMPDIR}/bootscripts/ @@ -359,46 +407,6 @@ function set_defaults { function dl_xload_uboot { -case "$DIST" in - maverick) - TEST_MD5SUM=$MAVERICK_MD5SUM - NETIMAGE=$MAVERICK_NETIMAGE - HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" - BASE_IMAGE="versatile" - ;; - natty) - TEST_MD5SUM=$NATTY_MD5SUM - NETIMAGE=$NATTY_NETIMAGE - HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" - BASE_IMAGE="versatile" - ;; - oneiric) - TEST_MD5SUM=$ONEIRIC_MD5SUM - NETIMAGE=$ONEIRIC_NETIMAGE - HTTP_IMAGE="http://ports.ubuntu.com/ubuntu-ports/dists" - BASE_IMAGE="linaro-vexpress" - ;; - squeeze) - TEST_MD5SUM=$SQUEEZE_MD5SUM - NETIMAGE=$SQUEEZE_NETIMAGE - HTTP_IMAGE="http://ftp.debian.org/debian/dists" - BASE_IMAGE="versatile" - ;; -esac - -if ls ${DIR}/dl/${DIST}/initrd.gz >/dev/null 2>&1;then - MD5SUM=$(md5sum ${DIR}/dl/${DIST}/initrd.gz | awk '{print $1}') - if [ "=$TEST_MD5SUM=" != "=$MD5SUM=" ]; then - echo "md5sum changed $MD5SUM" - rm -f ${DIR}/dl/${DIST}/initrd.gz || true - wget --directory-prefix=${DIR}/dl/${DIST} ${HTTP_IMAGE}/${DIST}/main/installer-armel/${NETIMAGE}/images/${BASE_IMAGE}/netboot/initrd.gz - NEW_MD5SUM=$(md5sum ${DIR}/dl/${DIST}/initrd.gz | awk '{print $1}') - echo "new md5sum $NEW_MD5SUM" - fi -else - wget --directory-prefix=${DIR}/dl/${DIST} ${HTTP_IMAGE}/${DIST}/main/installer-armel/${NETIMAGE}/images/${BASE_IMAGE}/netboot/initrd.gz -fi - if [ ! "${KERNEL_DEB}" ] ; then wget -c --directory-prefix=${DIR}/dl/${DIST} ${MIRROR}${DIST}/v${KERNEL}/${ACTUAL_DEB_FILE} else @@ -1360,6 +1368,7 @@ fi detect_software dl_bootloader dl_kernel_image + dl_netinstall_image boot_files_template set_defaults