From 4b8973dce870473fb15b9cf4776bb80cee5176ac Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 7 Oct 2013 06:29:13 +0200 Subject: Partitioning. --- pre-partman.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pre-partman.sh b/pre-partman.sh index c0cebee..527299a 100755 --- a/pre-partman.sh +++ b/pre-partman.sh @@ -160,6 +160,41 @@ if [ x"$RET" != x"none" ]; then fi +############################################################################## +# Partitioning + +anna-install parted-udeb +dev=/dev/sda +offset=`cat /sys/block/${dev#/dev/}/alignment_offset` +bs=`cat /sys/block/${dev#/dev/}/queue/physical_block_size` +if [ $offset -eq 0 ]; then + offset=64 +else + offset=$(( $offset / $bs )) +fi + +parted -sm $dev mklabel gpt +grain=$(( 256*32 )) +# All offset2's must be multiple of 256*32 = 8192 +if [ -d /proc/efi ] || [ -d /sys/firmware/efi ]; then + offset2=$(( 256 * 1024**2 / $bs )) + offset2=$(( $offset2 - $offset2 % $grain )) + parted -a minimal -sm $dev mkpart uefi ${offset}s $(( $offset2 - 1 ))s + offset=$offset2 + offset2=$(( $offset + 64 * 1024**2 / $bs )) + offset2=$(( $offset2 - $offset2 % $grain )) + parted -a minimal -sm $dev mkpart boot ${offset}s $(( $offset2 - 1))s + parted -sm $dev set 1 boot on +else + offset2=$(( 64 * 1024**2 / $bs )) + parted -a minimal -sm $dev mkpart boot ${offset}s $(( $offset2 - 1))s +fi +offset=$offset2 +offset2=$(( `cat /sys/block/${dev#/dev/}/size` - 1 )) +offset2=$(( $offset2 - $offset2 % $grain )) +parted -a optimal -sm $dev mkpart system ${offset}s $(( $offset2 - 1))s +system=${dev}$(parted -sm $dev p | grep -m 1 '^[1-9][0-9]*:.*:system:[^:]*;$' | sed 's/:.*//') +parted -sm $dev align-check opt ${system#$dev} -- cgit v1.2.3