mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
ChangeLog:
1. Added rEFInd boot manager support for both x86_64 and i386 UEFI EFISTUB booting. 2. Unify blkid options in setup script via . 3. Rename UUID to FSUUID, LABEL to FSLABEL and rename the corresponding functions getuuid and getlabel to getfsuuid and getfslabel recpectively.
This commit is contained in:
parent
755e6c35d8
commit
a77197d126
2 changed files with 320 additions and 212 deletions
|
@ -3,11 +3,8 @@
|
|||
run_hook ()
|
||||
{
|
||||
# fixing some symlinks
|
||||
ln -s /usr/sbin/chroot /bin/chroot
|
||||
# fix x86_64 symlink on x86_64
|
||||
[ "$(uname -r)" = "x86_64" ] && ln -s /usr/bin/setarch /usr/bin/x86_64
|
||||
# fix depmod link
|
||||
ln -s /sbin/depmod /bin/depmod
|
||||
# fix permission on /var/lock
|
||||
chmod 1777 /var/lock
|
||||
# fix vi symlink
|
||||
|
|
|
@ -8,6 +8,7 @@ LOG="/dev/tty7"
|
|||
# don't use /mnt because it's intended to mount other things there!
|
||||
DESTDIR="/tmp/install"
|
||||
EDITOR=""
|
||||
_BLKID="blkid -c /dev/null -p -i"
|
||||
|
||||
# name of kernel package
|
||||
KERNELPKG="linux"
|
||||
|
@ -130,25 +131,41 @@ chroot_umount()
|
|||
umount "${DESTDIR}/dev"
|
||||
}
|
||||
|
||||
# getuuid()
|
||||
# converts /dev devices to UUIDs
|
||||
getfstype()
|
||||
{
|
||||
echo "$(${_BLKID} -s TYPE -o value ${1})"
|
||||
}
|
||||
}
|
||||
|
||||
# getfsuuid()
|
||||
# converts /dev devices to FSUUIDs
|
||||
#
|
||||
# parameters: device file
|
||||
# outputs: UUID on success
|
||||
# outputs: FSUUID on success
|
||||
# nothing on failure
|
||||
# returns: nothing
|
||||
getuuid()
|
||||
getfsuuid()
|
||||
{
|
||||
echo "$(blkid -s UUID -o value ${1})"
|
||||
echo "$(${_BLKID} -s UUID -o value ${1})"
|
||||
}
|
||||
|
||||
# parameters: device file
|
||||
# outputs: LABEL on success
|
||||
# nothing on failure
|
||||
# returns: nothing
|
||||
getlabel()
|
||||
getfslabel()
|
||||
{
|
||||
echo "$(blkid -s LABEL -o value ${1})"
|
||||
echo "$(${_BLKID} -s LABEL -o value ${1})"
|
||||
}
|
||||
|
||||
getpartuuid()
|
||||
{
|
||||
echo "$(${_BLKID} -s PART_ENTRY_UUID -o value ${1})"
|
||||
}
|
||||
|
||||
getpartlabel()
|
||||
{
|
||||
echo "$(${_BLKID} -s PART_ENTRY_NAME -o value ${1})"
|
||||
}
|
||||
|
||||
# list eth devices with mac adress
|
||||
|
@ -204,8 +221,8 @@ activate_luks()
|
|||
ACTIVATE_LUKS=""
|
||||
if [[ -e /sbin/cryptsetup ]]; then
|
||||
DIALOG --infobox "Scanning for luks encrypted devices..." 0 0
|
||||
if [[ "$(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
for PART in $(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
||||
if [[ "$(${_BLKID} | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
for PART in $(${_BLKID} | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
||||
# skip already encrypted devices, device mapper!
|
||||
OPEN_LUKS=""
|
||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||
|
@ -434,14 +451,14 @@ additional_blockdevices_partitions() {
|
|||
#- part of raid device
|
||||
# $(cat /proc/mdstat 2>/dev/null | grep ${part})
|
||||
#- part of lvm2 device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "LVM2_member")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${part} | grep "LVM2_member")
|
||||
#- part of luks device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "crypto_LUKS")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${part} | grep "crypto_LUKS")
|
||||
#- extended partition on device
|
||||
# $(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g" 2>/dev/null | grep "5")
|
||||
#- bios_grub partitions
|
||||
# $(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${part})" || "$(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "LVM2_member")" || "$(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "crypto_LUKS")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g") 2>/dev/null | grep "5")" || "$(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${part})" || "$(${_BLKID} -o value -s TYPE /dev/${part} | grep "LVM2_member")" || "$(${_BLKID} -o value -s TYPE /dev/${part} | grep "crypto_LUKS")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g") 2>/dev/null | grep "5")" || "$(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
echo "/dev/${part}"
|
||||
[[ "${1}" ]] && echo ${1}
|
||||
fi
|
||||
|
@ -457,14 +474,14 @@ additional_blockdevices_partitions() {
|
|||
#- part of raid device
|
||||
# $(cat /proc/mdstat 2>/dev/null | grep ${i})
|
||||
#- part of lvm2 device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${i} | grep "LVM2_member")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${i} | grep "LVM2_member")
|
||||
#- part of luks device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${i} | grep "crypto_LUKS")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${i} | grep "crypto_LUKS")
|
||||
#- extended partition on device
|
||||
# $(sfdisk -c /dev/${dev} $(echo ${i} | sed -e "s#${dev}\p##g" 2>/dev/null | grep "5")
|
||||
#- bios_grub partitions
|
||||
# $(echo ${i} | grep "[a-z]$(parted /dev/${dev} print | grep bios_grub | cut -d " " -f 2)$")
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${i})" || "$(blkid -c=/dev/null -o value -s TYPE /dev/${i} | grep "LVM2_member")" || $(blkid -c=/dev/null -o value -s TYPE /dev/${i} | grep "crypto_LUKS") || "$(sfdisk -c /dev/${dev} $(echo ${i} | sed -e "s#${dev}\p##g") 2>/dev/null | grep "5")" || "$(echo ${i} | grep "[a-z]$(parted /dev/${dev} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${i})" || "$(${_BLKID} -o value -s TYPE /dev/${i} | grep "LVM2_member")" || $(${_BLKID} -o value -s TYPE /dev/${i} | grep "crypto_LUKS") || "$(sfdisk -c /dev/${dev} $(echo ${i} | sed -e "s#${dev}\p##g") 2>/dev/null | grep "5")" || "$(echo ${i} | grep "[a-z]$(parted /dev/${dev} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
echo "/dev/${i}"
|
||||
[[ "${1}" ]] && echo ${1}
|
||||
fi
|
||||
|
@ -478,7 +495,7 @@ raid_devices() {
|
|||
for devpath in $(ls ${block} 2>/dev/null | egrep '^md'); do
|
||||
if ! [[ "$(ls ${block}/${devpath} 2>/dev/null | egrep ${devpath}p)" ]]; then
|
||||
# exlude md partitions which are part of lvm or luks
|
||||
if ! [[ "$(blkid -c=/dev/null /dev/${devpath} | grep "TYPE=\"LVM2_member\"")" || "$(blkid -c=/dev/null /dev/${devpath} | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
if ! [[ "$(${_BLKID} /dev/${devpath} | grep "TYPE=\"LVM2_member\"")" || "$(${_BLKID} /dev/${devpath} | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
echo "/dev/${devpath}"
|
||||
[[ "${1}" ]] && echo ${1}
|
||||
fi
|
||||
|
@ -505,7 +522,7 @@ partitionable_raid_devices_partitions() {
|
|||
for i in $(ls ${block}/${dev} 2>/dev/null | egrep ${dev}p); do
|
||||
if [[ -d "${block}/${dev}/${i}" ]]; then
|
||||
# exlude md partitions which are part of lvm or luks
|
||||
if ! [[ "$(blkid -c=/dev/null /dev/${i} | grep "TYPE=\"LVM2_member\"")" || ! "$(blkid -c=/dev/null /dev/${i} | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
if ! [[ "$(${_BLKID} /dev/${i} | grep "TYPE=\"LVM2_member\"")" || ! "$(${_BLKID} /dev/${i} | grep "TYPE=\"crypto_LUKS\"")" ]]; then
|
||||
echo "/dev/${i}"
|
||||
[[ "${1}" ]] && echo ${1}
|
||||
fi
|
||||
|
@ -532,15 +549,15 @@ dmraid_devices() {
|
|||
# - remove part ot raid
|
||||
check_dm_devices() {
|
||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||
k="$(blkid -c=/dev/null /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g')"
|
||||
k="$(${_BLKID} /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g')"
|
||||
partofcrypt="${partofcrypt} ${k}"
|
||||
done
|
||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||
k="$(blkid -c=/dev/null /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"LVM2_member\"" | sed -e 's#:.*##g')"
|
||||
k="$(${_BLKID} /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"LVM2_member\"" | sed -e 's#:.*##g')"
|
||||
partoflvm="${partoflvm} ${k}"
|
||||
done
|
||||
for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control); do
|
||||
k="$(blkid -c=/dev/null /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g')"
|
||||
k="$(${_BLKID} /dev/mapper/${devpath} 2>/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g')"
|
||||
partofraid="${partofraid} ${k}"
|
||||
done
|
||||
}
|
||||
|
@ -592,16 +609,16 @@ default_partition_check() {
|
|||
#- part of raid device
|
||||
# $(cat /proc/mdstat 2>/dev/null | grep ${part})
|
||||
#- part of lvm2 device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "LVM2_member")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${part} | grep "LVM2_member")
|
||||
#- part of luks device
|
||||
# $(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "crypto_LUKS")
|
||||
# $(${_BLKID} -o value -s TYPE /dev/${part} | grep "crypto_LUKS")
|
||||
#- extended partition
|
||||
# $(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}##g") 2>/dev/null | grep "5")
|
||||
#- extended partition on raid partition device and mmc device
|
||||
# $(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g" 2>/dev/null | grep "5")
|
||||
#- bios_grub partitions
|
||||
# $(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${part})" || "$(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "LVM2_member")" || "$(blkid -c=/dev/null -o value -s TYPE /dev/${part} | grep "crypto_LUKS")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}##g") 2>/dev/null | grep "5")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g") 2>/dev/null | grep "5")" || "$(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
if ! [[ "$(cat /proc/mdstat 2>/dev/null | grep ${part})" || "$(${_BLKID} -o value -s TYPE /dev/${part} | grep "LVM2_member")" || "$(${_BLKID} -o value -s TYPE /dev/${part} | grep "crypto_LUKS")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}##g") 2>/dev/null | grep "5")" || "$(sfdisk -c /dev/${disk} $(echo ${part} | sed -e "s#${disk}\p##g") 2>/dev/null | grep "5")" || "$(echo ${part} | grep "[a-z]$(parted /dev/${disk} print | grep bios_grub | cut -d " " -f 2)$")" ]]; then
|
||||
if [[ -d ${block}/${disk}/${part} ]]; then
|
||||
echo "/dev/${part}"
|
||||
[[ "${1}" ]] && echo ${1}
|
||||
|
@ -838,7 +855,7 @@ geteditor() {
|
|||
# set device name scheme
|
||||
set_device_name_scheme() {
|
||||
NAME_SCHEME_PARAMETER=""
|
||||
NAME_SCHEME_LEVELS="UUID /dev/disk/by-uuid/<uuid> LABEL /dev/disk/by-label/<label> KERNEL /dev/<kernelname>"
|
||||
NAME_SCHEME_LEVELS="FSUUID /dev/disk/by-uuid/<uuid> FSLABEL /dev/disk/by-label/<label> KERNEL /dev/<kernelname>"
|
||||
DIALOG --menu "Select the device name scheme you want to use in config files (recommended is UUID)." 11 50 5 ${NAME_SCHEME_LEVELS} 2>${ANSWER} || return 1
|
||||
NAME_SCHEME_PARAMETER=$(cat ${ANSWER})
|
||||
NAME_SCHEME_PARAMETER_RUN="1"
|
||||
|
@ -935,17 +952,17 @@ _stopmd()
|
|||
mdadm --manage --stop /dev/${i} > ${LOG}
|
||||
done
|
||||
DIALOG --infobox "Cleaning superblocks of all software raid devices..." 0 0
|
||||
for i in $(blkid -c=/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g'); do
|
||||
for i in $(${_BLKID} | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g'); do
|
||||
mdadm --zero-superblock ${i} > ${LOG}
|
||||
done
|
||||
fi
|
||||
fi
|
||||
DISABLEMDSB=""
|
||||
if [[ "$(blkid -c=/dev/null | grep "TYPE=\"linux_raid_member\"")" ]]; then
|
||||
if [[ "$(${_BLKID} | grep "TYPE=\"linux_raid_member\"")" ]]; then
|
||||
DIALOG --defaultno --yesno "Setup detected superblock of raid devices, do you want to clean the superblock of them?" 0 0 && DISABLEMDSB="1"
|
||||
if [[ "${DISABLEMDSB}" = "1" ]]; then
|
||||
DIALOG --infobox "Cleaning superblocks of all software raid devices..." 0 0
|
||||
for i in $(blkid -c=/dev/null | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g'); do
|
||||
for i in $(${_BLKID} | grep "TYPE=\"linux_raid_member\"" | sed -e 's#:.*##g'); do
|
||||
mdadm --zero-superblock ${i} > ${LOG}
|
||||
done
|
||||
fi
|
||||
|
@ -1012,13 +1029,13 @@ _stopluks()
|
|||
DETECTED_LUKS=""
|
||||
|
||||
# detect not running luks devices
|
||||
[[ "$(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"")" ]] && DETECTED_LUKS=1
|
||||
[[ "$(${_BLKID} | grep "TYPE=\"crypto_LUKS\"")" ]] && DETECTED_LUKS=1
|
||||
if [[ "${DETECTED_LUKS}" = "1" ]]; then
|
||||
DIALOG --defaultno --yesno "Setup detected not running luks encrypted devices, do you want to remove them completely?" 0 0 && DISABLELUKS="1"
|
||||
fi
|
||||
if [[ "${DISABLELUKS}" = "1" ]]; then
|
||||
DIALOG --infobox "Removing not running luks encrypted devices ..." 0 0
|
||||
for i in $(blkid -c=/dev/null | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
||||
for i in $(${_BLKID} | grep "TYPE=\"crypto_LUKS\"" | sed -e 's#:.*##g'); do
|
||||
# delete header from device
|
||||
dd if=/dev/zero of=${i} bs=512 count=2048 >/dev/null 2>&1
|
||||
done
|
||||
|
@ -1926,7 +1943,7 @@ check_gpt() {
|
|||
DISC="$(df -T "${DESTDIR}/boot" | tail -n +2 | awk '{print $1}' | sed 's/\(.\{8\}\).*/\1/')"
|
||||
|
||||
GUID_DETECTED=""
|
||||
[[ "$(blkid -c /dev/null -p -i -o value -s PTTYPE ${DISC})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
[[ "$(${_BLKID} -o value -s PTTYPE ${DISC})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
|
||||
if [[ "${GUID_DETECTED}" == "" ]]; then
|
||||
if [[ "${CHECK_UEFISYS_PART}" == "1" ]]; then
|
||||
|
@ -1961,13 +1978,13 @@ check_gpt() {
|
|||
check_uefisyspart() {
|
||||
|
||||
if ! [[ "$(sgdisk -p ${DISC} | grep 'EF00')" ]]; then
|
||||
DIALOG --msgbox "Setup detected no UEFI SYSTEM PARTITION in ${DISC}. Please create a >=200 MiB FAT32 partition with gdisk type code EF00 .\n\nIf you already have a >=200 MiB UEFI SYSTEM Partition, check whether that partition has EF00 gdisk type code and is formatted as FAT32." 0 0
|
||||
DIALOG --msgbox "Setup detected no UEFI SYSTEM PARTITION in ${DISC}. Please create a >=512 MiB FAT32 partition with gdisk type code EF00 .\n\nIf you already have a >=512 MiB UEFI SYSTEM Partition, check whether that partition has EF00 gdisk type code and is formatted as FAT32." 0 0
|
||||
RUN_CGDISK="1"
|
||||
else
|
||||
if [[ -d "${DESTDIR}/boot/efi" ]] && [[ "$(mountpoint "${DESTDIR}/boot/efi")" ]]; then
|
||||
UEFISYS_PART="$(df -T "${DESTDIR}/boot/efi" | tail -n +2 | awk '{print $1}')"
|
||||
DISC="$(echo "${UEFISYS_PART}" | sed 's/\(.\{8\}\).*/\1/')"
|
||||
UEFISYS_PART_NUM="$(blkid -p -o value -s PART_ENTRY_NUMBER "${UEFISYS_PART}")"
|
||||
UEFISYS_PART_NUM="$(${_BLKID} -o value -s PART_ENTRY_NUMBER "${UEFISYS_PART}")"
|
||||
else
|
||||
[[ ! -d "${DESTDIR}/boot/efi" ]] && mkdir -p "${DESTDIR}/boot/efi"
|
||||
|
||||
|
@ -1976,10 +1993,10 @@ check_uefisyspart() {
|
|||
UEFISYS_PART="${DISC}${UEFISYS_PART_NUM}"
|
||||
fi
|
||||
|
||||
if [[ "$(blkid -p -i -o value -s TYPE ${UEFISYS_PART})" != "vfat" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE ${UEFISYS_PART})" != "vfat" ]]; then
|
||||
## Check whether UEFISYS is FAT, otherwise exit (any FAT variant, collectively recognized as vfat in Linux).
|
||||
DIALOG --msgbox "UEFI Specification requires UEFI SYSTEM PARTIION to be formatted as FAT32. Please format it as FAT32 and run /arch/setup ." 0 0 && return 1
|
||||
elif [[ "$(blkid -p -i -o value -s VERSION ${UEFISYS_PART})" != "FAT32" ]]; then
|
||||
elif [[ "$(${_BLKID} -o value -s VERSION ${UEFISYS_PART})" != "FAT32" ]]; then
|
||||
## Check whether UEFISYS is FAT32 (specifically), otherwise warn the user (but do not exit).
|
||||
DIALOG --msgbox "UEFI SYSTEM PARTIION is not FAT32 formatted. Some UEFI firmwares may not work properly with a FAT16 or FAT12 filesystem in the UEFISYS partition." 0 0
|
||||
fi
|
||||
|
@ -2027,7 +2044,7 @@ partition() {
|
|||
RUN_CGDISK="1"
|
||||
check_gpt
|
||||
else
|
||||
[[ "$(blkid -c /dev/null -p -i -o value -s PTTYPE ${DISC})" == "dos" ]] && MSDOS_DETECTED="1"
|
||||
[[ "$(${_BLKID} -o value -s PTTYPE ${DISC})" == "dos" ]] && MSDOS_DETECTED="1"
|
||||
|
||||
if [[ "${MSDOS_DETECTED}" == "" ]]; then
|
||||
DIALOG --defaultno --yesno "Setup detected no MS-DOS partition table on ${DISC}.\nDo you want to create a MS-DOS partition table now on ${DISC}?\n\n${DISC} will be COMPLETELY ERASED! Are you absolutely sure?" 0 0 || return 1
|
||||
|
@ -2081,7 +2098,7 @@ find_btrfs_raid_devices() {
|
|||
find_btrfs_raid_bootloader_devices() {
|
||||
btrfs_scan
|
||||
BTRFS_COUNT=1
|
||||
if [[ "$(blkid -c /dev/null ${bootdev} -o value -s TYPE)" = "btrfs" ]]; then
|
||||
if [[ "$(${_BLKID} ${bootdev} -o value -s TYPE)" = "btrfs" ]]; then
|
||||
BTRFS_DEVICES=""
|
||||
for i in $(btrfs filesystem show ${bootdev} | cut -d " " -f 11); do
|
||||
BTRFS_DEVICES="${BTRFS_DEVICES}#${i}"
|
||||
|
@ -2105,7 +2122,7 @@ find_btrfs_subvolume() {
|
|||
|
||||
find_btrfs_bootloader_subvolume() {
|
||||
BTRFS_SUBVOLUME_COUNT=1
|
||||
if [[ "$(blkid -c /dev/null ${bootdev} -o value -s TYPE)" = "btrfs" ]]; then
|
||||
if [[ "$(${_BLKID} ${bootdev} -o value -s TYPE)" = "btrfs" ]]; then
|
||||
BTRFS_SUBVOLUMES=""
|
||||
PART="${bootdev}"
|
||||
mount_btrfs
|
||||
|
@ -2394,7 +2411,7 @@ check_mkfs_values() {
|
|||
[[ "${BTRFS_LEVEL}" = "" ]] && BTRFS_LEVEL="NONE"
|
||||
[[ "${BTRFS_SUBVOLUME}" = "" ]] && BTRFS_SUBVOLUME="NONE"
|
||||
[[ "${DOSUBVOLUME}" = "" ]] && DOSUBVOLUME="no"
|
||||
[[ "${LABEL_NAME}" = "" && -n "$(blkid -c=/dev/null -o value -s LABEL ${PART})" ]] && LABEL_NAME="$(blkid -c=/dev/null -o value -s LABEL ${PART})"
|
||||
[[ "${LABEL_NAME}" = "" && -n "$(${_BLKID} -o value -s LABEL ${PART})" ]] && LABEL_NAME="$(${_BLKID} -o value -s LABEL ${PART})"
|
||||
[[ "${LABEL_NAME}" = "" ]] && LABEL_NAME="NONE"
|
||||
}
|
||||
|
||||
|
@ -2408,7 +2425,7 @@ create_filesystem() {
|
|||
if [[ "${DOMKFS}" = "yes" ]]; then
|
||||
while [[ "${LABEL_NAME}" = "" ]]; do
|
||||
DIALOG --inputbox "Enter the LABEL name for the device, keep it short\n(not more than 12 characters) and use no spaces or special\ncharacters." 10 65 \
|
||||
"$(blkid -c=/dev/null -o value -s LABEL ${PART})" 2>${ANSWER} || return 1
|
||||
"$(${_BLKID} -o value -s LABEL ${PART})" 2>${ANSWER} || return 1
|
||||
LABEL_NAME=$(cat ${ANSWER})
|
||||
if grep ":${LABEL_NAME}$" /tmp/.parts; then
|
||||
DIALOG --msgbox "ERROR: You have defined 2 identical LABEL names! Please enter another name." 8 65
|
||||
|
@ -2466,7 +2483,7 @@ mountpoints() {
|
|||
PART=$(cat ${ANSWER})
|
||||
PART_ROOT=${PART}
|
||||
# Select root filesystem type
|
||||
FSTYPE="$(blkid -c=/dev/null -o value -s TYPE ${PART})"
|
||||
FSTYPE="$(${_BLKID} -o value -s TYPE ${PART})"
|
||||
DOMKFS="no"
|
||||
# clear values first!
|
||||
clear_btrfs_values
|
||||
|
@ -2492,7 +2509,7 @@ mountpoints() {
|
|||
DIALOG --menu "Select any additional partitions to mount under your new root (select DONE when finished)" 21 52 13 ${PARTS} DONE _ 2>${ANSWER} || return 1
|
||||
PART=$(cat ${ANSWER})
|
||||
if [[ "${PART}" != "DONE" ]]; then
|
||||
FSTYPE="$(blkid -c=/dev/null -o value -s TYPE ${PART})"
|
||||
FSTYPE="$(${_BLKID} -o value -s TYPE ${PART})"
|
||||
DOMKFS="no"
|
||||
# clear values first!
|
||||
clear_btrfs_values
|
||||
|
@ -2674,17 +2691,17 @@ _mkfs() {
|
|||
fi
|
||||
fi
|
||||
# add to .device-names for config files
|
||||
local _uuid="$(getuuid ${_device})"
|
||||
local _label="$(getlabel ${_device})"
|
||||
echo "# DEVICE DETAILS: ${_device} UUID=${_uuid} LABEL=${_label}" >> /tmp/.device-names
|
||||
local _uuid="$(getfsuuid ${_device})"
|
||||
local _label="$(getfslabel ${_device})"
|
||||
echo "# DEVICE DETAILS: ${_device} UUID=${_fsuuid} LABEL=${_fslabel}" >> /tmp/.device-names
|
||||
# add to temp fstab
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
||||
if [[ -n "${_uuid}" ]]; then
|
||||
_device="UUID=${_uuid}"
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" ]]; then
|
||||
if [[ -n "${_fsuuid}" ]]; then
|
||||
_device="UUID=${_fsuuid}"
|
||||
fi
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
||||
if [[ -n "${_label}" ]]; then
|
||||
_device="LABEL=${_label}"
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
if [[ -n "${_fslabel}" ]]; then
|
||||
_device="LABEL=${_fslabel}"
|
||||
fi
|
||||
fi
|
||||
if [[ "${_fstype}" = "btrfs" && -n "${_btrfsmountoptions}" ]]; then
|
||||
|
@ -2967,28 +2984,28 @@ select_packages() {
|
|||
! [[ "$(echo ${PACKAGES} | grep -w dhclient)" ]] && PACKAGES="${PACKAGES} dhclient"
|
||||
fi
|
||||
# Add filesystem packages
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep ntfs)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep ntfs)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w ntfs-3g)" ]] && PACKAGES="${PACKAGES} ntfs-3g"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep btrfs)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep btrfs)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w btrfs-progs)" ]] && PACKAGES="${PACKAGES} btrfs-progs"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep nilfs2)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep nilfs2)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w nilfs-utils)" ]] && PACKAGES="${PACKAGES} nilfs-utils"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep ext)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep ext)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w e2fsprogs)" ]] && PACKAGES="${PACKAGES} e2fsprogs"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep reiserfs)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep reiserfs)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w reiserfsprogs)" ]] && PACKAGES="${PACKAGES} reiserfsprogs"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep xfs)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep xfs)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w xfsprogs)" ]] && PACKAGES="${PACKAGES} xfsprogs"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep jfs)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep jfs)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w jfsutils)" ]] && PACKAGES="${PACKAGES} jfsutils"
|
||||
fi
|
||||
if [[ "$(blkid -c /dev/null -o value -s TYPE | grep vfat)" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s TYPE | grep vfat)" ]]; then
|
||||
! [[ "$(echo ${PACKAGES} | grep -w dosfstools)" ]] && PACKAGES="${PACKAGES} dosfstools"
|
||||
fi
|
||||
if ! [[ "$(dmraid_devices)" = "" ]]; then
|
||||
|
@ -3243,15 +3260,15 @@ net_notdetectable() {
|
|||
done
|
||||
}
|
||||
|
||||
getrootfs() {
|
||||
ROOTFS="$(blkid -c /dev/null ${PART_ROOT} -o value -s TYPE)"
|
||||
getrootfstype() {
|
||||
ROOTFS="$(getfstype ${PART_ROOT})"
|
||||
}
|
||||
|
||||
getrootflags() {
|
||||
# remove rw for all filesystems and gcpid for nilfs2
|
||||
ROOTFLAGS=""
|
||||
ROOTFLAGS="$(findmnt -m -n -o options -T ${DESTDIR} | sed -e 's/^rw//g' -e 's/,gcpid=.*[0-9]//g')"
|
||||
[[ -n "${ROOTFLAGS}" ]] && ROOTFLAGS="rootflags=${ROOTFLAGS}"
|
||||
# remove rw for all filesystems and gcpid for nilfs2
|
||||
ROOTFLAGS=""
|
||||
ROOTFLAGS="$(findmnt -m -n -o options -T ${DESTDIR} | sed -e 's/^rw//g' -e 's/,gcpid=.*[0-9]//g')"
|
||||
[[ -n "${ROOTFLAGS}" ]] && ROOTFLAGS="rootflags=${ROOTFLAGS}"
|
||||
}
|
||||
|
||||
getraidarrays() {
|
||||
|
@ -3266,10 +3283,10 @@ getcryptsetup() {
|
|||
if ! [[ "$(cryptsetup status $(basename ${PART_ROOT}) | grep inactive)" ]]; then
|
||||
#avoid clash with dmraid here
|
||||
if [[ "$(cryptsetup status $(basename ${PART_ROOT}))" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
||||
CRYPTDEVICE="/dev/disk/by-uuid/$(echo $(blkid -s UUID -o value $(cryptsetup status $(basename ${PART_ROOT}) | grep device: | sed -e 's#device:##g')))"
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
||||
CRYPTDEVICE="/dev/disk/by-label/$(echo $(blkid -s LABEL -o value $(cryptsetup status $(basename ${PART_ROOT}) | grep device: | sed -e 's#device:##g')))"
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" ]]; then
|
||||
CRYPTDEVICE="/dev/disk/by-uuid/$(echo $(${_BLKID} -s UUID -o value $(cryptsetup status $(basename ${PART_ROOT}) | grep device: | sed -e 's#device:##g')))"
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
CRYPTDEVICE="/dev/disk/by-label/$(echo $(${_BLKID} -s LABEL -o value $(cryptsetup status $(basename ${PART_ROOT}) | grep device: | sed -e 's#device:##g')))"
|
||||
else
|
||||
CRYPTDEVICE="$(echo $(cryptsetup status $(basename ${PART_ROOT}) | grep device: | sed -e 's#device:##g'))"
|
||||
fi
|
||||
|
@ -3279,32 +3296,31 @@ getcryptsetup() {
|
|||
fi
|
||||
}
|
||||
|
||||
getrootuuid() {
|
||||
getrootfsuuid() {
|
||||
_rootpart="${PART_ROOT}"
|
||||
_uuid="$(getuuid ${PART_ROOT})"
|
||||
if [[ -n "${_uuid}" ]]; then
|
||||
_rootpart="/dev/disk/by-uuid/${_uuid}"
|
||||
_fsuuid="$(getfsuuid ${PART_ROOT})"
|
||||
if [[ -n "${_fsuuid}" ]]; then
|
||||
_rootpart="/dev/disk/by-uuid/${_fsuuid}"
|
||||
fi
|
||||
}
|
||||
|
||||
getrootlabel() {
|
||||
getrootfslabel() {
|
||||
_rootpart="${PART_ROOT}"
|
||||
_label="$(getlabel ${PART_ROOT})"
|
||||
if [[ -n "${_label}" ]]; then
|
||||
_rootpart="/dev/disk/by-label/${_label}"
|
||||
_fslabel="$(getfslabel ${PART_ROOT})"
|
||||
if [[ -n "${_fslabel}" ]]; then
|
||||
_rootpart="/dev/disk/by-label/${_fslabel}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# basic checks needed for all bootloaders
|
||||
common_bootloader_checks() {
|
||||
activate_special_devices
|
||||
getrootfs
|
||||
getrootfstype
|
||||
getraidarrays
|
||||
getcryptsetup
|
||||
getrootflags
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "UUID" ]] && getrootuuid
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "LABEL" ]] && getrootlabel
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" ]] && getrootfsuuid
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]] && getrootfslabel
|
||||
}
|
||||
|
||||
# look for a separately-mounted /boot partition
|
||||
|
@ -3319,7 +3335,7 @@ check_bootpart() {
|
|||
|
||||
# check for btrfs bootpart and abort if detected
|
||||
abort_btrfs_bootpart() {
|
||||
FSTYPE="$(blkid -c /dev/null ${bootdev} -o value -s TYPE)"
|
||||
FSTYPE="$(${_BLKID} ${bootdev} -o value -s TYPE)"
|
||||
if [[ "${FSTYPE}" = "btrfs" ]]; then
|
||||
DIALOG --msgbox "Error:\nYour selected bootloader cannot boot from btrfs partition with /boot on it." 0 0
|
||||
return 1
|
||||
|
@ -3328,13 +3344,205 @@ abort_btrfs_bootpart() {
|
|||
|
||||
# check for nilfs2 bootpart and abort if detected
|
||||
abort_nilfs_bootpart() {
|
||||
FSTYPE="$(blkid -c /dev/null ${bootdev} -o value -s TYPE)"
|
||||
FSTYPE="$(${_BLKID} ${bootdev} -o value -s TYPE)"
|
||||
if [[ "${FSTYPE}" = "nilfs2" ]]; then
|
||||
DIALOG --msgbox "Error:\nYour selected bootloader cannot boot from nilfs2 partition with /boot on it." 0 0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
do_uefi_x86_64() {
|
||||
|
||||
export UEFI_ARCH="x86_64"
|
||||
export SPEC_UEFI_ARCH="x64"
|
||||
|
||||
}
|
||||
|
||||
do_uefi_i386() {
|
||||
|
||||
export UEFI_ARCH="i386"
|
||||
export SPEC_UEFI_ARCH="ia32"
|
||||
|
||||
}
|
||||
|
||||
do_uefi_efibootmgr() {
|
||||
|
||||
modprobe -q efivars
|
||||
|
||||
if [[ "$(lsmod | grep ^efivars)" ]]; then
|
||||
chroot_mount
|
||||
|
||||
if [[ -d "${DESTDIR}/sys/firmware/efi/vars" ]]; then
|
||||
cat << EFIBEOF > "${DESTDIR}/efibootmgr_run.sh"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
for _bootnum in \$(efibootmgr | grep '^Boot[0-9]' | fgrep -i '${_EFIBOOTMGR_LABEL}' | cut -b5-8) ; do
|
||||
efibootmgr --bootnum "\${_bootnum}" --delete-bootnum
|
||||
done
|
||||
|
||||
echo
|
||||
efibootmgr --verbose --create --gpt --disk "${_EFIBOOTMGR_DISC}" --part "${_EFIBOOTMGR_PART_NUM}" --write-signature --label '${_EFIBOOTMGR_LABEL}' --loader '\\EFI\\${_EFIBOOTMGR_LOADER_DIR}\\${_EFIBOOTMGR_LOADER_FILE}'
|
||||
echo
|
||||
|
||||
EFIBEOF
|
||||
|
||||
chmod a+x "${DESTDIR}/efibootmgr_run.sh"
|
||||
chroot "${DESTDIR}" "/bin/bash" "/efibootmgr_run.sh" &>"/tmp/efibootmgr_run.log"
|
||||
mv "${DESTDIR}/efibootmgr_run.sh" "/tmp/efibootmgr_run.sh"
|
||||
else
|
||||
DIALOG --msgbox "${DESTDIR}/sys/firmware/efi/vars/ directory not found. Check whether you have booted in UEFI boot mode, manually load efivars kernel module and create a boot entry for ${_EFIBOOTMGR_LABEL} in the UEFI Boot Manager." 0 0
|
||||
fi
|
||||
|
||||
chroot_umount
|
||||
else
|
||||
DIALOG --msgbox "efivars kernel module was not loaded properly. Manually load it and create a boot entry for ${_EFIBOOTMGR_LABEL} in UEFI Boot Manager using efibootmgr." 0 0
|
||||
fi
|
||||
|
||||
unset _EFIBOOTMGR_LABEL
|
||||
unset _EFIBOOTMGR_DISC
|
||||
unset _EFIBOOTMGR_PART_NUM
|
||||
unset _EFIBOOTMGR_LOADER_DIR
|
||||
unset _EFIBOOTMGR_LOADER_FILE
|
||||
|
||||
}
|
||||
|
||||
do_apple_efi_hfs_bless() {
|
||||
|
||||
modprobe -q -r efivars || true
|
||||
|
||||
## Grub upstream bzr mactel branch => http://bzr.savannah.gnu.org/lh/grub/branches/mactel/changes
|
||||
## Fedora's mactel-boot => https://bugzilla.redhat.com/show_bug.cgi?id=755093
|
||||
DIALOG --msgbox "TODO: Apple Mac EFI Bootloader Setup" 0 0
|
||||
|
||||
}
|
||||
|
||||
do_uefi_bootmgr_setup() {
|
||||
|
||||
if [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Inc.' ]] || [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Computer, Inc.' ]]; then
|
||||
do_apple_efi_hfs_bless
|
||||
else
|
||||
## For all the non-Mac UEFI systems
|
||||
_EFIBOOTMGR_LABEL="${_BOOTMGR_LABEL}"
|
||||
_EFIBOOTMGR_DISC="${_BOOTMGR_DISC}"
|
||||
_EFIBOOTMGR_PART_NUM="${_BOOTMGR_PART_NUM}"
|
||||
_EFIBOOTMGR_LOADER_DIR="${_BOOTMGR_LOADER_DIR}"
|
||||
_EFIBOOTMGR_LOADER_FILE="${_BOOTMGR_LOADER_FILE}"
|
||||
do_uefi_efibootmgr
|
||||
fi
|
||||
|
||||
unset _BOOTMGR_LABEL
|
||||
unset _BOOTMGR_DISC
|
||||
unset _BOOTMGR_PART_NUM
|
||||
unset _BOOTMGR_LOADER_DIR
|
||||
unset _BOOTMGR_LOADER_FILE
|
||||
|
||||
}
|
||||
|
||||
dorefind_uefi_common() {
|
||||
|
||||
if [[ "$(uname -m)" != "${UEFI_ARCH}" ]]; then
|
||||
DIALOG --msgbox "EFISTUB support requires Kernel and UEFI arch to be same, and requires CONFIG_EFI_STUB enabled >=3.3 kernel." 0 0
|
||||
elif [[ "${KERNELPKG}" == "linux-lts" ]]; then
|
||||
DIALOG --msgbox "LTS kernel does not support EFISTUB. Please install CONFIG_EFI_STUB enabled kernel and try again." 0 0
|
||||
else
|
||||
USE_DMRAID=""
|
||||
common_bootloader_checks
|
||||
|
||||
DISC="$(df -T "${DESTDIR}/boot" | tail -n +2 | awk '{print $1}' | sed 's/\(.\{8\}\).*/\1/')"
|
||||
|
||||
if ! [[ "${DISC}" == "" ]]; then
|
||||
CHECK_UEFISYS_PART="1"
|
||||
CHECK_BIOS_BOOT_GRUB2=""
|
||||
RUN_CGDISK=""
|
||||
check_gpt
|
||||
fi
|
||||
|
||||
DIALOG --msgbox "Installing rEFInd-${UEFI_ARCH} now ..." 0 0
|
||||
# PACKAGES="rEFInd-${UEFI_ARCH} dosfstools"
|
||||
PACKAGES="dosfstools efibootmgr"
|
||||
run_pacman
|
||||
PACKAGES=""
|
||||
|
||||
_REFIND_VER="0.2.6"
|
||||
|
||||
wget -O "/tmp/refind-bin-${_REFIND_VER}.zip" "http://downloads.sourceforge.net/refind/refind-bin-${_REFIND_VER}.zip"
|
||||
bsdtar -C "/tmp" -xf "/tmp/refind-bin-${_REFIND_VER}.zip"
|
||||
|
||||
install -d "${DESTDIR}/boot/efi/efi/arch/refind"
|
||||
install -D -m0644 "/tmp/refind-bin-${_REFIND_VER}/refind/refind_${SPEC_UEFI_ARCH}.efi" "${DESTDIR}/boot/efi/efi/arch/refind/refind${SPEC_UEFI_ARCH}.efi"
|
||||
install -D -m0644 "/tmp/refind-bin-${_REFIND_VER}/refind/refind.conf-sample" "${DESTDIR}/boot/efi/efi/arch/refind/refind.conf"
|
||||
cp -r "/tmp/refind-bin-${_REFIND_VER}/refind/icons" "${DESTDIR}/boot/efi/efi/arch/refind/icons"
|
||||
|
||||
sed 's|^#showtools shell, about, reboot|showtools shell,about,exit,shutdown,reboot|g' -i "${DESTDIR}/boot/efi/efi/arch/refind/refind.conf"
|
||||
sed 's|^scanfor internal,external,optical|scanfor internal,external,optical,manual|g' -i "${DESTDIR}/boot/efi/efi/arch/refind/refind.conf"
|
||||
|
||||
# install -D -m0644 "${DESTDIR}/boot/efi/efi/arch/refind/refind_linux.conf" "${DESTDIR}/boot/efi/efi/arch/refind_linux.conf" || true
|
||||
|
||||
_bootdev="$(df -T "${DESTDIR}/boot" | tail -n +2 | awk '{print $1}')"
|
||||
_rootdev="$(df -T "${DESTDIR}/" | tail -n +2 | awk '{print $1}')"
|
||||
_uefisysdev="$(df -T "${DESTDIR}/boot/efi" | tail -n +2 | awk '{print $1}')"
|
||||
|
||||
ROOT_PART_FS_UUID="$(getfsuuid "${_rootdev}")"
|
||||
ROOT_PART_FS_LABEL="$(getfslabel "${_rootdev}")"
|
||||
ROOT_PART_GPT_GUID="$(getpartuuid "${_rootdev}")"
|
||||
ROOT_PART_GPT_LABEL="$(getpartlabel "${_rootdev}")"
|
||||
|
||||
getrootfstype
|
||||
|
||||
# UEFISYS_PART_FS_UUID="$(getfsuuid "${_uefisysdev}")"
|
||||
# UEFISYS_PART_FS_LABEL="$(getfslabel "${_uefisysdev}")"
|
||||
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" ]] && _rootpart="UUID=${ROOT_PART_FS_UUID}"
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "PARTUUID" ]] && _rootpart="/dev/disk/by-partuuid/${ROOT_PART_GPT_GUID}"
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]] && _rootpart="LABEL=${ROOT_PART_FS_LABEL}"
|
||||
[[ "${NAME_SCHEME_PARAMETER}" == "PARTLABEL" ]] && _rootpart="/dev/disk/by-partlabel/${ROOT_PART_GPT_LABEL}"
|
||||
[[ "${_rootpart}" == "" ]] && _rootpart="${ROOT_PART_DEVICE}"
|
||||
|
||||
## TODO: All complex stuff like dmraid, cyptsetup etc. for kernel parameters - common_bootloader_checks ?
|
||||
_PARAMETERS_UNMOD="root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro gpt loglevel=7 pcie_aspm=force initrd=\\EFI\\arch\\${INITRAMFS}.img"
|
||||
_PARAMETERS_MOD=$(echo "${_PARAMETERS_UNMOD}" | sed -e 's# # #g' | sed -e 's# # #g')
|
||||
|
||||
cat << REFINDEOF > "${DESTDIR}/boot/efi/efi/arch/refind_linux.conf"
|
||||
"Boot with Defaults" "${_PARAMETERS_MOD}"
|
||||
REFINDEOF
|
||||
|
||||
install -D -m0644 "${DESTDIR}/boot/${VMLINUZ}" "${DESTDIR}/boot/efi/efi/arch/${VMLINUZ}.efi"
|
||||
install -D -m0644 "${DESTDIR}/boot/${INITRAMFS}.img" "${DESTDIR}/boot/efi/efi/arch/${INITRAMFS}.img"
|
||||
|
||||
DIALOG --msgbox "You will now be put into the editor to edit refind.conf and refind_linux.conf . After you save your changes and exit the editor." 0 0
|
||||
geteditor || return 1
|
||||
"${EDITOR}" "${DESTDIR}/boot/efi/efi/arch/refind/refind.conf"
|
||||
"${EDITOR}" "${DESTDIR}/boot/efi/efi/arch/refind_linux.conf"
|
||||
|
||||
_DISC="$(echo "${_uefisysdev}" | sed 's/\(.\{8\}\).*/\1/')"
|
||||
UEFISYS_PART_NUM="$(${_BLKID} -s PART_ENTRY_NUMBER -o value "${_uefisysdev}")"
|
||||
|
||||
_BOOTMGR_LABEL="Arch Linux (rEFInd)"
|
||||
_BOOTMGR_DISC="${_DISC}"
|
||||
_BOOTMGR_PART_NUM="${UEFISYS_PART_NUM}"
|
||||
_BOOTMGR_LOADER_DIR="arch\\refind"
|
||||
_BOOTMGR_LOADER_FILE="refind${SPEC_UEFI_ARCH}.efi"
|
||||
do_uefi_bootmgr_setup
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
dorefind_uefi_x86_64() {
|
||||
|
||||
do_uefi_x86_64
|
||||
|
||||
dorefind_uefi_common
|
||||
|
||||
}
|
||||
|
||||
dorefind_uefi_i386() {
|
||||
|
||||
do_uefi_i386
|
||||
|
||||
dorefind_uefi_common
|
||||
|
||||
}
|
||||
|
||||
# install syslinux and run preparation
|
||||
prepare_syslinux() {
|
||||
if ! [[ -e "${DESTDIR}/usr/sbin/extlinux" || -e "${DESTDIR}/usr/bin/mcopy" ]]; then
|
||||
|
@ -3366,7 +3574,7 @@ common_syslinux() {
|
|||
|
||||
# check if GPT/GUID is used
|
||||
GUID_DETECTED=""
|
||||
[[ "$(blkid -c /dev/null -p -i -o value -s PTTYPE ${ROOTDEV})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
[[ "$(${_BLKID} value -s PTTYPE ${ROOTDEV})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
|
||||
PARTITION_NUMBER=$(echo ${bootdev} | sed -e 's#.*[a-z]##g')
|
||||
if [[ "${GUID_DETECTED}" == '1' ]]; then
|
||||
|
@ -3420,7 +3628,7 @@ EOF
|
|||
echo "MENU LABEL Arch Linux" >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
echo "LINUX ${subdir}/${VMLINUZ}" >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "UUID" || "${NAME_SCHEME_PARAMETER}" == "LABEL" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" || "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
echo "append initrd=${subdir}/${INITRAMFS}.img root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
else
|
||||
echo "append initrd=${subdir}/${INITRAMFS}.img root=${PART_ROOT} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
|
@ -3433,7 +3641,7 @@ EOF
|
|||
echo "MENU LABEL Arch Linux Fallback" >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
echo "LINUX ${subdir}/${VMLINUZ}" >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "UUID" || "${NAME_SCHEME_PARAMETER}" == "LABEL" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" || "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
echo "append initrd=${subdir}/${INITRAMFS}-fallback.img root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP}" | sed -e 's# # #g' >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
else
|
||||
echo "append initrd=${subdir}/${INITRAMFS}-fallback.img root=${PART_ROOT} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP}" | sed -e 's# # #g' >> "${TEMPDIR}/${SYSLINUX_CONF}"
|
||||
|
@ -3458,7 +3666,7 @@ finish_syslinux () {
|
|||
|
||||
# check if GPT/GUID is used
|
||||
GUID_DETECTED=""
|
||||
[[ "$(blkid -c /dev/null -p -i -o value -s PTTYPE ${ROOTDEV})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
[[ "$(${_BLKID} -o value -s PTTYPE ${ROOTDEV})" == "gpt" ]] && GUID_DETECTED="1"
|
||||
|
||||
if [[ "${GUID_DETECTED}" == '1' ]]; then
|
||||
cat "${GPTMBR}" > "${ROOTDEV}"
|
||||
|
@ -3493,7 +3701,7 @@ dosyslinux_bios () {
|
|||
abort_nilfs_bootpart || return 1
|
||||
|
||||
# extlinux only can boot from ext2/3/4 and btrfs partitions!
|
||||
FSTYPE="$(blkid -c /dev/null -o value -s TYPE ${bootdev})"
|
||||
FSTYPE="$(${_BLKID} -o value -s TYPE ${bootdev})"
|
||||
if ! [[ "${FSTYPE}" == "ext2" || "${FSTYPE}" == "ext3" || "${FSTYPE}" == "ext4" || "${FSTYPE}" == "btrfs" || "${FSTYPE}" == "vfat" ]]; then
|
||||
DIALOG --msgbox "Error:\nCouldn't find ext2/3/4 , btrfs or vfat partition with /boot on it." 0 0
|
||||
return 1
|
||||
|
@ -3550,7 +3758,7 @@ dolilo_bios() {
|
|||
check_bootpart
|
||||
|
||||
# check on GUID (gpt)
|
||||
if [[ "$(blkid -c /dev/null -p -i -o value -s PART_ENTRY_SCHEME ${bootdev})" == "gpt" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s PART_ENTRY_SCHEME ${bootdev})" == "gpt" ]]; then
|
||||
DIALOG --defaultno --yesno "Warning:\nSetup detected GUID (gpt) partition table.\n\nLilo doesn't support booting from GUID (gpt) partition table.\n\nDo you want to install lilo to an other device, which contains a msdos partition table?" 0 0 || return 1
|
||||
fi
|
||||
|
||||
|
@ -3559,7 +3767,7 @@ dolilo_bios() {
|
|||
|
||||
# Try to auto-configure LILO...
|
||||
if ! [[ "${PART_ROOT}" = "" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" || "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" || "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
sed -i "s|.*root=.*$|append=\"root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro\"|g" ${DESTDIR}/etc/lilo.conf
|
||||
else
|
||||
sed -i "s|.*root=.*$|append=\"root=${PART_ROOT} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro\"|g" ${DESTDIR}/etc/lilo.conf
|
||||
|
@ -3655,7 +3863,7 @@ dogrub_legacy_bios() {
|
|||
check_bootpart
|
||||
|
||||
# check on GUID (gpt)
|
||||
if [[ "$(blkid -c /dev/null -p -i -o value -s PART_ENTRY_SCHEME ${bootdev})" == "gpt" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s PART_ENTRY_SCHEME ${bootdev})" == "gpt" ]]; then
|
||||
DIALOG --defaultno --yesno "Warning:\nSetup detected GUID (gpt) partition table.\n\nGrub doesn't support booting from GUID (gpt) partition table.\n\nDo you want to install grub to an other device, which contains a msdos partition table?" 0 0 || return 1
|
||||
fi
|
||||
|
||||
|
@ -3714,7 +3922,7 @@ dogrub_legacy_bios() {
|
|||
echo "# (${NUMBER}) Arch Linux" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
echo "title Arch Linux" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
echo "root ${grubdev}" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" || "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" || "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
echo "kernel ${subdir}/${VMLINUZ} root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' | sed -e 's# # #g' >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
else
|
||||
echo "kernel ${subdir}/${VMLINUZ} root=${PART_ROOT} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' | sed -e 's# # #g' >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
|
@ -3726,7 +3934,7 @@ dogrub_legacy_bios() {
|
|||
echo "# (${NUMBER}) Arch Linux" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
echo "title Arch Linux Fallback" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
echo "root ${grubdev}" >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" || "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" || "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
echo "kernel ${subdir}/${VMLINUZ} root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' | sed -e 's# # #g' >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
else
|
||||
echo "kernel ${subdir}/${VMLINUZ} root=${PART_ROOT} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro" | sed -e 's# # #g' | sed -e 's# # #g' >> "${DESTDIR}/boot/grub/menu.lst"
|
||||
|
@ -3797,7 +4005,7 @@ EOF
|
|||
cp -f /tmp/dev.map ${DESTDIR}/boot/grub/device.map
|
||||
DIALOG --msgbox "GRUB was successfully installed." 0 0
|
||||
S_GRUB=1
|
||||
if [[ "$(blkid -c /dev/null | grep TYPE=\"linux_raid_member\")" ]]; then
|
||||
if [[ "$(${_BLKID} | grep TYPE=\"linux_raid_member\")" ]]; then
|
||||
if [[ "${redundant}" = "1" ]]; then
|
||||
DIALOG --defaultno --yesno "Setup detected a redundant software raid device.\nDo you want to install grub additionally to an other hard disk?" 0 0 && S_GRUB=""
|
||||
fi
|
||||
|
@ -3878,9 +4086,9 @@ dogrub2_config() {
|
|||
########
|
||||
|
||||
## udev 180 onwards
|
||||
if [[ "$(blkid -c /dev/null -p -i -o value -s PART_ENTRY_SCHEME ${ROOT_PART_DEVICE})" == 'gpt' ]]; then
|
||||
ROOT_PART_GPT_UUID="$(blkid -c /dev/null -p -i -o value -s PART_ENTRY_UUID ${ROOT_PART_DEVICE})"
|
||||
ROOT_PART_GPT_LABEL="$(blkid -c /dev/null -p -i -o value -s PART_ENTRY_NAME ${ROOT_PART_DEVICE})"
|
||||
if [[ "$(${_BLKID} -o value -s PART_ENTRY_SCHEME ${ROOT_PART_DEVICE})" == 'gpt' ]]; then
|
||||
ROOT_PART_GPT_GUID="$(${_BLKID} -o value -s PART_ENTRY_UUID ${ROOT_PART_DEVICE})"
|
||||
ROOT_PART_GPT_LABEL="$(${_BLKID} -o value -s PART_ENTRY_NAME ${ROOT_PART_DEVICE})"
|
||||
fi
|
||||
|
||||
########
|
||||
|
@ -3998,17 +4206,17 @@ EOF
|
|||
sort "/tmp/.device-names" >> "${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg"
|
||||
echo "" >> "${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg"
|
||||
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "UUID" ]]; then
|
||||
if [[ "${NAME_SCHEME_PARAMETER}" == "FSUUID" ]]; then
|
||||
GRUB_ROOT_DRIVE="search --fs-uuid --no-floppy --set=root ${BOOT_PART_HINTS_STRING} ${BOOT_PART_FS_UUID}"
|
||||
_rootpart="/dev/disk/by-uuid/${ROOT_PART_FS_UUID}"
|
||||
_rootpart="UUID=${ROOT_PART_FS_UUID}"
|
||||
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "PARTUUID" ]]; then
|
||||
GRUB_ROOT_DRIVE="search --fs-uuid --no-floppy --set=root ${BOOT_PART_HINTS_STRING} ${BOOT_PART_FS_UUID}" # GRUB2 does not yet support PARTUUID
|
||||
_rootpart="/dev/disk/by-partuuid/${ROOT_PART_GPT_UUID}"
|
||||
_rootpart="/dev/disk/by-partuuid/${ROOT_PART_GPT_GUID}"
|
||||
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "LABEL" ]]; then
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "FSLABEL" ]]; then
|
||||
GRUB_ROOT_DRIVE="search --label --no-floppy --set=root ${BOOT_PART_HINTS_STRING} ${BOOT_PART_FS_LABEL}"
|
||||
_rootpart="/dev/disk/by-label/${ROOT_PART_FS_LABEL}"
|
||||
_rootpart="LABEL=${ROOT_PART_FS_LABEL}"
|
||||
|
||||
elif [[ "${NAME_SCHEME_PARAMETER}" == "PARTLABEL" ]]; then
|
||||
GRUB_ROOT_DRIVE="search --label --no-floppy --set=root ${BOOT_PART_HINTS_STRING} ${BOOT_PART_FS_LABEL}" # GRUB2 does not yet support PARTLABEL
|
||||
|
@ -4024,7 +4232,7 @@ EOF
|
|||
[[ -z "${ROOT_PART_FS_LABEL}" ]] && _rootpart="${ROOT_PART_DEVICE}"
|
||||
[[ -z "${ROOT_PART_FS_UUID}" ]] && _rootpart="${ROOT_PART_DEVICE}"
|
||||
|
||||
LINUX_UNMOD_COMMAND="linux ${subdir}/${VMLINUZ} root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro gpt loglevel=7 pcie_aspm=force add_efi_memmap"
|
||||
LINUX_UNMOD_COMMAND="linux ${subdir}/${VMLINUZ} root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro gpt loglevel=7 pcie_aspm=force"
|
||||
LINUX_MOD_COMMAND=$(echo "${LINUX_UNMOD_COMMAND}" | sed -e 's# # #g' | sed -e 's# # #g')
|
||||
|
||||
## create default kernel entry
|
||||
|
@ -4182,7 +4390,7 @@ dogrub2_bios() {
|
|||
|
||||
if [[ "${FAIL_COMPLEX}" == "0" ]]; then
|
||||
grubdev=$(basename ${bootdev})
|
||||
complexuuid=$(getuuid ${bootdev})
|
||||
complexuuid=$(getfsuuid ${bootdev})
|
||||
|
||||
# check if mapper is used
|
||||
if [[ "$(echo ${bootdev} | grep /dev/mapper)" ]]; then
|
||||
|
@ -4250,7 +4458,7 @@ dogrub2_bios() {
|
|||
bootdev=$(cat ${ANSWER})
|
||||
fi
|
||||
|
||||
if [[ "$(blkid -c /dev/null -p -i -o value -s PTTYPE ${bootdev})" == "gpt" ]]; then
|
||||
if [[ "$(${_BLKID} -o value -s PTTYPE ${bootdev})" == "gpt" ]]; then
|
||||
CHECK_BIOS_BOOT_GRUB2="1"
|
||||
CHECK_UEFISYS_PART=""
|
||||
RUN_CGDISK=""
|
||||
|
@ -4296,101 +4504,6 @@ dogrub2_bios() {
|
|||
|
||||
}
|
||||
|
||||
do_uefi_x86_64() {
|
||||
|
||||
export UEFI_ARCH="x86_64"
|
||||
export SPEC_UEFI_ARCH="x64"
|
||||
|
||||
}
|
||||
|
||||
do_uefi_i386() {
|
||||
|
||||
export UEFI_ARCH="i386"
|
||||
export SPEC_UEFI_ARCH="ia32"
|
||||
|
||||
}
|
||||
|
||||
do_uefi_efibootmgr() {
|
||||
|
||||
modprobe -q efivars
|
||||
|
||||
if [[ "$(lsmod | grep ^efivars)" ]]; then
|
||||
chroot_mount
|
||||
|
||||
if [[ -d "${DESTDIR}/sys/firmware/efi/vars" ]]; then
|
||||
cat << EFIBEOF > "${DESTDIR}/efibootmgr_run.sh"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
for _bootnum in \$(efibootmgr | grep '^Boot[0-9]' | fgrep -i '${_EFIBOOTMGR_LABEL}' | cut -b5-8) ; do
|
||||
efibootmgr --bootnum "\${_bootnum}" --delete-bootnum
|
||||
done
|
||||
|
||||
echo
|
||||
efibootmgr --verbose --create --gpt --disk "${_EFIBOOTMGR_DISC}" --part "${_EFIBOOTMGR_PART_NUM}" --write-signature --label '${_EFIBOOTMGR_LABEL}' --loader '\\EFI\\${_EFIBOOTMGR_LOADER_DIR}\\${_EFIBOOTMGR_LOADER_FILE}'
|
||||
echo
|
||||
|
||||
EFIBEOF
|
||||
|
||||
chmod a+x "${DESTDIR}/efibootmgr_run.sh"
|
||||
chroot "${DESTDIR}" "/bin/bash" "/efibootmgr_run.sh" &>"/tmp/efibootmgr_run.log"
|
||||
mv "${DESTDIR}/efibootmgr_run.sh" "/tmp/efibootmgr_run.sh"
|
||||
else
|
||||
DIALOG --msgbox "${DESTDIR}/sys/firmware/efi/vars/ directory not found. Check whether you have booted in UEFI boot mode, manually load efivars kernel module and create a boot entry for ${_EFIBOOTMGR_LABEL} in the UEFI Boot Manager." 0 0
|
||||
fi
|
||||
|
||||
chroot_umount
|
||||
else
|
||||
DIALOG --msgbox "efivars kernel module was not loaded properly. Manually load it and create a boot entry for ${_EFIBOOTMGR_LABEL} in UEFI Boot Manager using efibootmgr." 0 0
|
||||
fi
|
||||
|
||||
unset _EFIBOOTMGR_LABEL
|
||||
unset _EFIBOOTMGR_DISC
|
||||
unset _EFIBOOTMGR_PART_NUM
|
||||
unset _EFIBOOTMGR_LOADER_DIR
|
||||
unset _EFIBOOTMGR_LOADER_FILE
|
||||
|
||||
}
|
||||
|
||||
do_apple_efi_hfs_bless() {
|
||||
|
||||
modprobe -q -r efivars || true
|
||||
|
||||
## Grub upstream bzr mactel branch => http://bzr.savannah.gnu.org/lh/grub/branches/mactel/changes
|
||||
## Fedora's mactel-boot => https://bugzilla.redhat.com/show_bug.cgi?id=755093
|
||||
DIALOG --msgbox "TODO: Apple Mac EFI Bootloader Setup" 0 0
|
||||
|
||||
}
|
||||
|
||||
do_uefi_bootmgr_setup() {
|
||||
|
||||
if [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Inc.' ]] || [[ "$(cat "/sys/class/dmi/id/sys_vendor")" == 'Apple Computer, Inc.' ]]; then
|
||||
do_apple_efi_hfs_bless
|
||||
else
|
||||
## For all the non-Mac UEFI systems
|
||||
_EFIBOOTMGR_LABEL="${_BOOTMGR_LABEL}"
|
||||
_EFIBOOTMGR_DISC="${_BOOTMGR_DISC}"
|
||||
_EFIBOOTMGR_PART_NUM="${_BOOTMGR_PART_NUM}"
|
||||
_EFIBOOTMGR_LOADER_DIR="${_BOOTMGR_LOADER_DIR}"
|
||||
_EFIBOOTMGR_LOADER_FILE="${_BOOTMGR_LOADER_FILE}"
|
||||
do_uefi_efibootmgr
|
||||
fi
|
||||
|
||||
unset _BOOTMGR_LABEL
|
||||
unset _BOOTMGR_DISC
|
||||
unset _BOOTMGR_PART_NUM
|
||||
unset _BOOTMGR_LOADER_DIR
|
||||
unset _BOOTMGR_LOADER_FILE
|
||||
|
||||
}
|
||||
|
||||
dorefind_uefi_x86_64() {
|
||||
|
||||
do_uefi_x86_64
|
||||
|
||||
DIALOG --msgbox "TODO: rEFInd x86_64 UEFI Boot Manager Setup" 0 0
|
||||
|
||||
}
|
||||
|
||||
dogrub2_uefi_bootmgr() {
|
||||
|
||||
_BOOTMGR_LABEL="Arch Linux (GRUB2)"
|
||||
|
@ -4409,10 +4522,6 @@ dogrub2_uefi_common() {
|
|||
DIALOG --msgbox "Installing grub2-efi-${UEFI_ARCH} now ..." 0 0
|
||||
PACKAGES="grub2-efi-${UEFI_ARCH} grub2-common dosfstools"
|
||||
|
||||
if [[ "$(cat "/sys/class/dmi/id/sys_vendor")" != "Apple Inc." ]] && [[ "$(cat "/sys/class/dmi/id/sys_vendor")" != "Apple Computer, Inc." ]]; then
|
||||
PACKAGES="${PACKAGES} efibootmgr"
|
||||
fi
|
||||
|
||||
run_pacman
|
||||
# reset PACKAGES after installing
|
||||
PACKAGES=""
|
||||
|
@ -4871,7 +4980,7 @@ auto_hwdetect() {
|
|||
[[ $(mount | grep "${DESTDIR}/usr ") ]] && HWPARAMETER="${HWPARAMETER} --shutdown"
|
||||
# add persistent net and sound options
|
||||
HWPARAMETER="${HWPARAMETER} --net --sound"
|
||||
[[ "$(blkid -c=/dev/null -o value -s TYPE ${PART_ROOT})" = "btrfs" ]] && HWPARAMETER="${HWPARAMETER} --btrfs"
|
||||
[[ "$(${_BLKID} -o value -s TYPE ${PART_ROOT})" = "btrfs" ]] && HWPARAMETER="${HWPARAMETER} --btrfs"
|
||||
HWDETECTMODULES="$(echo $(hwdetect ${FBPARAMETER} --hostcontroller --filesystem ${HWPARAMETER}) | sed -e 's#.*\" ##g')"
|
||||
HWDETECTHOOKS="$(hwdetect --rootdevice=${PART_ROOT} --hooks-dir=${DESTDIR}/lib/initcpio/install ${FBPARAMETER} ${HWPARAMETER} --hooks)"
|
||||
[[ -n "${HWDETECTMODULES}" ]] && sed -i -e "s/^MODULES=.*/${HWDETECTMODULES}/g" ${DESTDIR}/etc/mkinitcpio.conf
|
||||
|
@ -5057,11 +5166,11 @@ configure_system() {
|
|||
install_bootloader_uefi_x86_64() {
|
||||
|
||||
DIALOG --menu "Which x86_64 UEFI bootloader would you like to use?" 13 55 2 \
|
||||
"GRUB2_UEFI_x86_64" "GRUB2 x86_64 UEFI" 2>${ANSWER} || CANCEL=1
|
||||
# "rEFInd" "rEFInd x86_64" 2>${ANSWER} || CANCEL=1
|
||||
"GRUB2_UEFI_x86_64" "GRUB2 x86_64 UEFI" \
|
||||
"rEFInd_x86_64" "rEFInd x86_64 (supports only x86_64 EFISTUB kernels)" 2>${ANSWER} || CANCEL=1
|
||||
case $(cat ${ANSWER}) in
|
||||
"GRUB2_UEFI_x86_64") dogrub2_uefi_x86_64 ;;
|
||||
# "rEFInd") dorefind_uefi_x86_64 ;;
|
||||
"rEFInd_x86_64") dorefind_uefi_x86_64 ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
@ -5069,9 +5178,11 @@ install_bootloader_uefi_x86_64() {
|
|||
install_bootloader_uefi_i386() {
|
||||
|
||||
DIALOG --menu "Which i386 UEFI bootloader would you like to use?" 13 55 1 \
|
||||
"GRUB2_UEFI_i386" "GRUB2 i386 UEFI" 2>${ANSWER} || CANCEL=1
|
||||
"GRUB2_UEFI_i386" "GRUB2 i386 UEFI" \
|
||||
"rEFInd_i386" "rEFInd i386 (supports only ix86 EFISTUB kernels)" 2>${ANSWER} || CANCEL=1
|
||||
case $(cat ${ANSWER}) in
|
||||
"GRUB2_UEFI_i386") dogrub2_uefi_i386 ;;
|
||||
"rEFInd_i386") dorefind_uefi_i386 ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
@ -5105,7 +5216,7 @@ install_bootloader() {
|
|||
|
||||
[[ "$(grep UEFI_ARCH_x86_64 /proc/cmdline)" ]] && UEFI_x86_64="1"
|
||||
|
||||
[[ "${UEFI_x86_64}" == "1" ]] && DIALOG --yesno "Setup has detected that you are using x86_64 (64-bit) UEFI ...\nDo you like to install grub2-efi-x86_64 as the bootloader?" 0 0 && dogrub2_uefi_x86_64
|
||||
[[ "${UEFI_x86_64}" == "1" ]] && DIALOG --yesno "Setup has detected that you are using x86_64 (64-bit) UEFI ...\nDo you like to install a x86_64 UEFI bootloader?" 0 0 && install_bootloader_uefi_x86_64
|
||||
|
||||
DIALOG --menu "x86_64 UEFI or i386 UEFI or BIOS?" 13 55 3 \
|
||||
"UEFI_x86_64" "x86_64 UEFI" \
|
||||
|
|
Loading…
Reference in a new issue