diff options
-rwxr-xr-x | pre-partman.sh | 35 |
1 files changed, 35 insertions, 0 deletions
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} |