From: Patrick McCarty Date: Thu, 1 Aug 2013 17:59:20 +0000 (-0700) Subject: Split partitioning logic to either run sfdisk or sgdisk X-Git-Tag: accepted/tizen/20130912.150740~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F7711%2F7;p=platform%2Fupstream%2Fpc-installer.git Split partitioning logic to either run sfdisk or sgdisk Using the input string generated in the appropriate *_options function, now partition the device using either sfdisk or sgdisk. Only MBR and GPT are supported, so any other partition table formats are ignored. Change-Id: I78ee6bb7fd6077725b30fa5f8622c4ab3c6dcdfc --- diff --git a/scripts/system-installer b/scripts/system-installer index 68d2ecc..2159017 100644 --- a/scripts/system-installer +++ b/scripts/system-installer @@ -151,14 +151,22 @@ function gpt_partition_options { [ -n "$typeid" ] && params=$(printf "${params}%s" " --typecode=${partnum}:${typeid}") } -function partition_device { - /usr/sbin/sfdisk -uM $TARGET_DEV << EOF -,2000,82 -,,83,*; +function partition_msdos { + # make sure there is a newline in the heredoc, + # or else sfdisk fails to parse the input + /usr/sbin/sfdisk --in-order -uM ${TARGET_DEV} << EOF +${1} + EOF sync } +function partition_gpt { + /usr/sbin/sgdisk -Z ${TARGET_DEV} + /usr/sbin/sgdisk ${1} ${TARGET_DEV} + sync +} + function format_device { /usr/sbin/mkswap ${TARGET_DEV}1 @@ -285,6 +293,7 @@ find_devices message "Installing on to the hard disk now, this will take a few minutes..." pnum=0 +# first, generate the option list to pass to either 'sfdisk' or 'sgdisk' while [ "$pnum" -lt "$INSTALLERFW_PART_COUNT" ]; do if [ "$INSTALLERFW_PTABLE_FORMAT" = "msdos" ]; then msdos_partition_options $pnum @@ -294,7 +303,13 @@ while [ "$pnum" -lt "$INSTALLERFW_PART_COUNT" ]; do pnum="$((pnum+1))" done -partition_device +# now, do the partitioning +if [ "$INSTALLERFW_PTABLE_FORMAT" = "msdos" ]; then + partition_msdos "$params" +elif [ "$INSTALLERFW_PTABLE_FORMAT" = "gpt" ]; then + partition_gpt "$params" +fi + format_device mount_devices install_os