diff --git a/scripts/0-preinstall.sh b/scripts/0-preinstall.sh index 9069b9f..917f8f3 100755 --- a/scripts/0-preinstall.sh +++ b/scripts/0-preinstall.sh @@ -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} diff --git a/scripts/startup.sh b/scripts/startup.sh index 8406227..4b31bdb 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -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