From 844ff7391864cf9fd2d25f3edd6a9f3c571bfef0 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Sat, 21 Apr 2012 07:34:16 -0500 Subject: [PATCH] card script: check for software, before trying to figure out what version we have Signed-off-by: Robert Nelson --- mk_mmc.sh | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/mk_mmc.sh b/mk_mmc.sh index 653a6e5..679293b 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -111,29 +111,10 @@ function is_valid_addon { } function check_root { -if [[ $UID -ne 0 ]]; then - echo "$0 must be run as sudo user or root" - exit -fi -} - -function find_issue { - -check_root - -#Software Qwerks - -#Check for gnu-fdisk -#FIXME: GNU Fdisk seems to halt at "Using /dev/xx" when trying to script it.. -if fdisk -v | grep "GNU Fdisk" >/dev/null ; then - echo "Sorry, this script currently doesn't work with GNU Fdisk" - exit -fi - -unset PARTED_ALIGN -if parted -v | grep parted | grep 2.[1-3] >/dev/null ; then - PARTED_ALIGN="--align cylinder" -fi + if [[ $UID -ne 0 ]]; then + echo "$0 must be run as sudo user or root" + exit + fi } function check_for_command { @@ -166,6 +147,18 @@ function detect_software { echo "" exit fi + + #Check for gnu-fdisk + #FIXME: GNU Fdisk seems to halt at "Using /dev/xx" when trying to script it.. + if fdisk -v | grep "GNU Fdisk" >/dev/null ; then + echo "Sorry, this script currently doesn't work with GNU Fdisk" + exit + fi + + unset PARTED_ALIGN + if parted -v | grep parted | grep 2.[1-3] >/dev/null ; then + PARTED_ALIGN="--align cylinder" + fi } function rcn-ee_down_use_mirror { @@ -1730,7 +1723,7 @@ while [ ! -z "$1" ]; do then PARTITION_PREFIX="p" fi - find_issue + check_root check_mmc ;; --uboot) @@ -1802,7 +1795,7 @@ fi echo "Script Version git: ${GIT_VERSION}" echo "-----------------------------" - find_issue + check_root detect_software dl_bootloader dl_kernel_image