introduces first boody partitioning

This commit is contained in:
Lukas Graz 2022-05-02 08:04:14 +02:00
parent 723ca87a75
commit 6f61ab7a0f
2 changed files with 54 additions and 17 deletions

View File

@ -51,18 +51,46 @@ echo -ne "
-------------------------------------------------------------------------
"
umount -A --recursive /mnt # make sure everything is unmounted before we start
# disk prep
sgdisk -Z ${DISK} # zap all on disk #X destroys/wipes the whole drive
sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
# create partitions
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition)
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system
sgdisk -A 1:set:2 ${DISK}
if [[ $PARTITION_STRATEGY == "Dual_Boot" || $PARTITION_STRATEGY == "Manual_Partition" ]]; then
# echo -ne "
# First free up some space for new partitions:\n"
# echo -ne "
# Create the following partitions manually: \n
# 1. BIOSBOOT 1M (gdisk code is ef02) \n
# 2. EFIBOOT 300M \n
# 3. ROOT 10G+ \n\n
# "
echo "set up partition table on your own, good luck :)"
echo "DISK = $DISK"
echo "press any key to start"
read temp_variable
bash
elif [[ $PARTITION_STRATEGY == "Auto_Partition" ]]; then
# disk prep
sgdisk -Z ${DISK} # zap all on disk #X destroys/wipes the whole drive
sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
# create partitions
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition)
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system
sgdisk -A 1:set:2 ${DISK} # set the bit 2 attribute (legacy BIOS bootable) on partition 1
fi
partprobe ${DISK} # reread partition table to ensure it is correct
if [[ "${DISK}" =~ "nvme" ]]; then
partition2=${DISK}p2
partition3=${DISK}p3
else
partition2=${DISK}2
partition3=${DISK}3
fi
fi
partprobe ${DISK} # reread partition table to ensure it is correct
# make filesystems
echo -ne "
@ -98,13 +126,6 @@ subvolumesetup () {
mountallsubvol
}
if [[ "${DISK}" =~ "nvme" ]]; then
partition2=${DISK}p2
partition3=${DISK}p3
else
partition2=${DISK}2
partition3=${DISK}3
fi
if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}

View File

@ -301,9 +301,25 @@ installtype () {
# More features in future
# language (){}
# my functions, --- start here ----
partitionstrategy () {
echo -ne "Would you like to: Dual_boot / Manual_partition / Auto_partition \n\n
Dual_Boot: Manual_partition + Dualboot things \n
Manual_Partition: set up manually partition table \n
Auto_Partition: Whipe *ALL DATA* on the whole disk (all partitions) \n"
options=(Dual_Boot / Manual_Partition / Auto_Partition)
select_option $? 4 "${options[@]}"
partition_strategy=${options[$?]}
set_option PARTITION_STRATEGY $partition_strategy
}
# my functions, --- end here ----
# Starting functions
clear
logo
partitionstrategy
clear
logo
userinfo
clear
logo