the diff between setup_sdcard.sh is getting to big, lets merge alot of code, therefore this script now has to be run as root/sudo

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
pull/8/head
Robert Nelson 13 years ago
parent 66945fcd41
commit 385a59c4a2

@ -63,6 +63,19 @@ SQUEEZE_MD5SUM="b0caf7d86e9dc37e8d5b8c39d47c4884"
DIR=$PWD DIR=$PWD
TEMPDIR=$(mktemp -d) TEMPDIR=$(mktemp -d)
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 #Software Qwerks
#fdisk 2.18.x/2.19.x, dos no longer default #fdisk 2.18.x/2.19.x, dos no longer default
unset FDISK_DOS unset FDISK_DOS
@ -83,6 +96,8 @@ if sudo parted -v | grep parted | grep 2.[1-3] >/dev/null ; then
PARTED_ALIGN="--align cylinder" PARTED_ALIGN="--align cylinder"
fi fi
}
function detect_software { function detect_software {
echo "This script needs:" echo "This script needs:"
@ -1141,6 +1156,8 @@ function checkparm {
fi fi
} }
IN_VALID_UBOOT=1
# parse commandline options # parse commandline options
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
case $1 in case $1 in
@ -1150,7 +1167,7 @@ while [ ! -z "$1" ]; do
;; ;;
--probe-mmc) --probe-mmc)
MMC="/dev/idontknow" MMC="/dev/idontknow"
detect_software check_root
check_mmc check_mmc
;; ;;
--mmc) --mmc)
@ -1160,7 +1177,7 @@ while [ ! -z "$1" ]; do
then then
PARTITION_PREFIX="p" PARTITION_PREFIX="p"
fi fi
detect_software find_issue
check_mmc check_mmc
;; ;;
--uboot) --uboot)
@ -1218,6 +1235,9 @@ if [ "$IN_VALID_UBOOT" ] ; then
usage usage
fi fi
find_issue
detect_software
boot_files_template boot_files_template
set_defaults set_defaults
dl_xload_uboot dl_xload_uboot

Loading…
Cancel
Save