From 5c607126ff8fbb43e9111e390ba28d8e7e57bb2a Mon Sep 17 00:00:00 2001 From: proledatarian Date: Sun, 13 Feb 2022 15:18:55 +0000 Subject: [PATCH] Update install.sh --- install.sh | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..bd2ecd0 --- /dev/null +++ b/install.sh @@ -0,0 +1,144 @@ +#!/bin/bash + +#PS3="Please select a disk to partition:" +echo "Please select a disk to partition:" + +# Don't separate values by space. +IFS=$'\n' + +# Set variable containing name and size of all disks. +disks=( $(lsblk -d | tail -n+2 | awk '{print $1" "$4}') ) + +# Declare the array. +declare -a disks + +# Select value on array. +select disk in ${disks[*]} +do + +# Separate values by spaces. +IFS=' ' + +# Create new variable of selection. +array=($disk) +dev="${array[0]}" +echo -e + +# Starting partitioning. +echo "Partitioning /dev/$dev.." +echo -e + +# Clearing partition table of selected disk. +echo "Clearing existing partitioning table." +sgdisk -Z /dev/$dev && +echo -e + +# Creating boot partition. +size="${array[1]%?}" +echo "Creating boot partition of 256 MB." +sgdisk -n 1:0:+256M /dev/$dev && + +# Setting type for EFI. +sgdisk -t 1:ef00 /dev/$dev && +echo -e + +# Creating system partition. +echo "Creating system partition of $size GB." +sgdisk -n 2:0:0 /dev/$dev +echo -e + +# Print partitions. +echo "This is your new partition table:" +lsblk | grep "$dev" + +echo $dev > /tmp/disk + +# Exit. +break +done + +# Get variable from filesystem. +part=$(