Update boot flag setting

This commit is contained in:
natemaia 2018-08-25 21:23:48 -07:00
parent d97736a344
commit 5b93073fda

View File

@ -14,7 +14,7 @@
# immutable variables { # immutable variables {
readonly DIST="Archlabs" # Linux distributor readonly DIST="Archlabs" # Linux distributor
readonly VER="1.6.45" # Installer version readonly VER="1.6.46" # Installer version
readonly LIVE="liveuser" # Live session user readonly LIVE="liveuser" # Live session user
readonly TRN="/usr/share/archlabs-installer" # Translation path readonly TRN="/usr/share/archlabs-installer" # Translation path
readonly MNT="/mnt/install" # Install mountpoint readonly MNT="/mnt/install" # Install mountpoint
@ -803,6 +803,8 @@ auto_partition() {
check_for_errors "parted -s $device mkpart primary ext4 1MiB 513MiB" check_for_errors "parted -s $device mkpart primary ext4 1MiB 513MiB"
mkfs.ext4 -q $BOOT_PART >/dev/null 2>$ERR mkfs.ext4 -q $BOOT_PART >/dev/null 2>$ERR
check_for_errors "mkfs.ext4 -q $BOOT_PART" check_for_errors "mkfs.ext4 -q $BOOT_PART"
parted -s $device set $part_num boot on 2>$ERR
check_for_errors "parted -s $device set $part_num boot on"
else else
parted -s $device mkpart ESP fat32 1MiB 513MiB 2>$ERR parted -s $device mkpart ESP fat32 1MiB 513MiB 2>$ERR
check_for_errors "parted -s $device mkpart ESP fat32 1MiB 513MiB" check_for_errors "parted -s $device mkpart ESP fat32 1MiB 513MiB"
@ -812,9 +814,6 @@ auto_partition() {
check_for_errors "parted -s $device set $part_num esp on" check_for_errors "parted -s $device set $part_num esp on"
fi fi
parted -s $device set $part_num boot on 2>$ERR
check_for_errors "parted -s $device set $part_num boot on"
(( part_num++ )) # increment the partition number (( part_num++ )) # increment the partition number
BOOT_DEVICE="$device" # only grub on BIOS systems uses this BOOT_DEVICE="$device" # only grub on BIOS systems uses this
ROOT_PART="${device}${nvme}$part_num" # set root partition label to the second partition ROOT_PART="${device}${nvme}$part_num" # set root partition label to the second partition
@ -1004,17 +1003,22 @@ select_boot_setup() {
setup_boot_device() { setup_boot_device() {
# set BOOT_DEVICE for syslinux on UEFI and grub on BIOS # set BOOT_DEVICE for syslinux on UEFI and grub on BIOS
BOOT_DEVICE="${BOOT_PART%%([1-9]|(p)[1-9])}" if [[ $BOOT_PART =~ nvme ]]; then
BOOT_DEVICE="${BOOT_PART%p[1-9]}"
else
BOOT_DEVICE="${BOOT_PART%[1-9]}"
fi
BOOT_PART_NUM="${BOOT_PART: -1}" BOOT_PART_NUM="${BOOT_PART: -1}"
# setup the needed partition flags for boot on both system types # setup the needed partition flags for boot on both system types
parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on 2>$ERR parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on 2>$ERR
check_for_errors "parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on" check_for_errors "parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on"
if [[ $SYS == 'UEFI' ]]; then if [[ $SYS == 'UEFI' ]]; then
parted -s $BOOT_DEVICE set $BOOT_PART_NUM esp on 2>$ERR parted -s $BOOT_DEVICE set $BOOT_PART_NUM esp on 2>$ERR
check_for_errors "parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on" check_for_errors "parted -s $BOOT_DEVICE set $BOOT_PART_NUM boot on"
fi fi
return 0 return 0
} }
@ -1037,13 +1041,11 @@ select_efi_partition() {
if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then
local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2" local msg="$_FormUefiBody $BOOT_PART $_FormUefiBody2"
yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no" && yesno "$_PrepMount" "$msg" "Format $BOOT_PART" "Do Not Format" "no" &&
format_efi_as_vfat "$BOOT_PART" format_efi_as_vfat "$BOOT_PART"
else else
format_efi_as_vfat "$BOOT_PART" format_efi_as_vfat "$BOOT_PART"
fi fi
setup_boot_device
return 0 return 0
} }
@ -1069,8 +1071,6 @@ select_boot_partition() {
else else
format_as_ext4 "$BOOT_PART" format_as_ext4 "$BOOT_PART"
fi fi
setup_boot_device
fi fi
return 0 return 0
} }
@ -1174,6 +1174,7 @@ select_partitions() {
select_boot_setup || { BOOTLOADER=""; return 1; } select_boot_setup || { BOOTLOADER=""; return 1; }
if [[ $BOOT_PART != "" ]]; then if [[ $BOOT_PART != "" ]]; then
setup_boot_device
mount_partition "$BOOT_PART" "${BOOT_MNTS[$SYS-$BOOTLOADER]}" || return 1 mount_partition "$BOOT_PART" "${BOOT_MNTS[$SYS-$BOOTLOADER]}" || return 1
SEPERATE_BOOT=1 SEPERATE_BOOT=1
fi fi