aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-10-07 06:29:13 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 04:27:27 +0200
commit4b8973dce870473fb15b9cf4776bb80cee5176ac (patch)
treea3147b46e3352335344deb5e1ea6c71c006dd0ea
parent56c9372d22859203caf7dcabf271896ddf9e216c (diff)
Partitioning.
-rwxr-xr-xpre-partman.sh35
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}