[ -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
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
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