Update partition.sh

This commit is contained in:
proledatarian 2022-02-12 15:35:38 +00:00
parent c0a0a78181
commit 8f1553ce94
1 changed files with 17 additions and 2 deletions

View File

@ -15,24 +15,39 @@ declare -a disks
# Select value on array. # Select value on array.
select disk in ${disks[*]} select disk in ${disks[*]}
do do
# Separate values by spaces.
IFS=' ' IFS=' '
# Create new variable of selection.
array=($disk) array=($disk)
dev="${array[0]}" dev="${array[0]}"
echo -e
echo "Partitioning /dev/$dev." # Starting partitioning.
echo "Partitioning /dev/$dev.."
echo -e
# Clearing partition table of selected disk.
echo "Clearing existing partitioning table." echo "Clearing existing partitioning table."
sgdisk -Z /dev/$dev && sgdisk -Z /dev/$dev &&
echo -e echo -e
# Creating boot partition.
size="${array[1]%?}" size="${array[1]%?}"
echo "Creating boot partition of 256 MB." echo "Creating boot partition of 256 MB."
sgdisk -n 1:0:+256M /dev/$dev && sgdisk -n 1:0:+256M /dev/$dev &&
echo -e echo -e
# Creating system partition.
echo "Creating system partition of $size GB." echo "Creating system partition of $size GB."
sgdisk -n 2:0:0 /dev/$dev sgdisk -n 2:0:0 /dev/$dev
echo -e
# Print partitions.
echo "This is your new partition table:" echo "This is your new partition table:"
lsblk lsblk | grep "$dev"
# Exit.
break break
done done