diff --git a/0-preinstall.sh b/0-preinstall.sh index e3369df..fcc0cfb 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -53,10 +53,14 @@ sgdisk -Z ${DISK} # zap all on disk 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 +if [ -d /sys/firmware/efi ]; then + sgdisk -n 1::+250M --typecode=1:8300 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (Linux System Partition) + sgdisk -n 2::+100M --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 +else + 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 sgdisk -A 1:set:2 ${DISK} fi # make filesystems @@ -81,23 +85,32 @@ mountallsubvol () { } if [[ "${DISK}" =~ "nvme" ]]; then + partition1=${DISK}p1 partition2=${DISK}p2 partition3=${DISK}p3 else + partition1=${DISK}1 partition2=${DISK}2 partition3=${DISK}3 fi +# The filesystem type for the boot partition shouldn't really matter, however +# I didn't test such case in my installer script so I left the lines commented out +mkfs.ext2 -L "BOOT" ${partition1} + if [[ "${FS}" == "btrfs" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${partition2} + #mkfs.btrfs -L "BOOT" ${partition1} mkfs.btrfs -L ROOT ${partition3} -f mount -t btrfs ${partition3} /mnt elif [[ "${FS}" == "ext4" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${partition2} + #mkfs.ext4 -L "BOOT" ${partition1} mkfs.ext4 -L ROOT ${partition3} mount -t ext4 ${partition3} /mnt elif [[ "${FS}" == "luks" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${partition2} + #mkfs.ext2 -L "BOOT" ${partition1} # enter luks password to cryptsetup and format root partition echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${partition3} - # open luks container and ROOT will be place holder @@ -126,10 +139,18 @@ umount /mnt mount -t btrfs -o subvol=@ -L ROOT /mnt fi -# mount target -mkdir /mnt/boot -mkdir /mnt/boot/efi -mount -t vfat -L EFIBOOT /mnt/boot/ +#for UEFI, /boot needs to be mounted to the BIOSBOOT partitio nand /boot/efi needs to be mounted +#to the EFIBOOT partition; for BIOS, only /boot needs to be mounted to the EFIBOOT partition +if [ -d /sys/firmware/efi ]; then + mkdir -p /mnt/boot + mount ${partition1} /mnt/boot + mkdir -p /mnt/boot/efi + mount ${partition2} /mnt/boot/efi +else + mkdir -p /mnt/boot + mount ${partition2} /mnt/boot +fi + if ! grep -qs '/mnt' /proc/mounts; then echo "Drive is not mounted can not continue" @@ -153,7 +174,7 @@ echo -ne " ------------------------------------------------------------------------- " if [[ ! -d "/sys/firmware/efi" ]]; then - grub-install --boot-directory=/mnt/boot ${DISK} + grub-install --boot-directory=/mnt/boot --recheck ${DISK} fi echo -ne " ------------------------------------------------------------------------- diff --git a/3-post-setup.sh b/3-post-setup.sh index d9a2641..ec84162 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -18,7 +18,7 @@ GRUB EFI Bootloader Install & Check source /root/ArchTitus/setup.conf genfstab -U / >> /etc/fstab if [[ -d "/sys/firmware/efi" ]]; then - grub-install --efi-directory=/boot ${DISK} + grub-install --target=x86_64-efi --efi-directory=/boot/efi --recheck ${DISK} fi # set kernel parameter for decrypting the drive if [[ "${FS}" == "luks" ]]; then diff --git a/archtitus.sh b/archtitus.sh index 821bb39..6069f43 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -35,4 +35,8 @@ echo -ne " Automated Arch Linux Installer ------------------------------------------------------------------------- Done - Please Eject Install Media and Reboot + + Do not forgot to edit '/etc/mkinitcpio.conf' and put the correct + parameters for LUKS and btrfs (if those were selected) and run + 'arch-chroot /mnt mkinitcpio -P' or your system will not boot! "