diff --git a/usr/bin/archboot-allinone.sh b/usr/bin/archboot-allinone.sh index a943383b6..70d6bc90b 100755 --- a/usr/bin/archboot-allinone.sh +++ b/usr/bin/archboot-allinone.sh @@ -9,6 +9,11 @@ _BASENAME="$(basename "${0}")" +[[ -z "${_UEFI_ARCH}" ]] && _UEFI_ARCH="x86_64" + +[[ "${_UEFI_ARCH}" == "x86_64" ]] && _SPEC_UEFI_ARCH="x64" +[[ "${_UEFI_ARCH}" == "i386" ]] && _SPEC_UEFI_ARCH="ia32" + usage () { echo "${_BASENAME}: usage" echo "CREATE ALLINONE USB/CD IMAGES" @@ -206,14 +211,14 @@ _download_uefi_shell_tianocore() { mkdir -p "${ALLINONE}/EFI/tools/" ## Download Tianocore UDK/EDK2 ShellBinPkg UEFI "Full Shell" - For UEFI Spec. >=2.3 systems - curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${ALLINONE}/EFI/tools/shellx64.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi" + curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${ALLINONE}/EFI/tools/shellx64_v2.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi" ## Download Tianocore UDK/EDK2 EdkShellBinPkg UEFI "Full Shell" - For UEFI Spec. <2.3 systems - curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${ALLINONE}/EFI/tools/shellx64_old.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi" + curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${ALLINONE}/EFI/tools/shellx64_v1.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi" } -_download_uefi_refind_sourceforge() { +_download_uefi_refind_bin_sourceforge() { mkdir -p "${ALLINONE}/packages/" @@ -222,10 +227,45 @@ _download_uefi_refind_sourceforge() { } -_prepare_grub_uefi_arch_specific_iso_files() { +_prepare_uefi_gummiboot_USB_files() { - [[ "${_UEFI_ARCH}" == "x86_64" ]] && _SPEC_UEFI_ARCH="x64" - [[ "${_UEFI_ARCH}" == "i386" ]] && _SPEC_UEFI_ARCH="ia32" + mkdir -p "${ALLINONE}/EFI/boot" + cp -f "/boot/efi/EFI/arch/gummiboot/gummiboot${_SPEC_UEFI_ARCH}.efi" "${ALLINONE}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" + cp -f "/boot/efi/EFI/arch/efilinux/efilinux${_SPEC_UEFI_ARCH}.efi" "${ALLINONE}/EFI/boot/efilinux${_SPEC_UEFI_ARCH}.efi" + + mkdir -p "${ALLINONE}/loader/entries/" + + cat << EOF > "${ALLINONE}/loader/entries/loader.conf" +timeout 3 +default archboot-${_UEFI_ARCH} +EOF + + cat << EOF > "${ALLINONE}/loader/entries/archboot-${_UEFI_ARCH}.conf" +title Arch Linux (${_UEFI_ARCH}) archboot +linux /boot/vmlinuz_${_UEFI_ARCH} +initrd /boot/initramfs_${_UEFI_ARCH}.img +options gpt loglevel=7 add_efi_memmap none=UEFI_ARCH_${_UEFI_ARCH} +EOF + + cat << EOF > "${ALLINONE}/loader/entries/archboot-${_UEFI_ARCH}-lts.conf" +title Arch Linux LTS (${_UEFI_ARCH}) archboot +efi /EFI/boot/efilinux${_SPEC_UEFI_ARCH}.efi +options -f \\boot\\vmlinuz_x86_64_lts gpt loglevel=7 add_efi_memmap none=UEFI_ARCH_${_UEFI_ARCH} initrd=\\boot\\initramfs_${_UEFI_ARCH}.img +EOF + + cat << EOF > "${ALLINONE}/loader/entries/uefi-shell-${_UEFI_ARCH}-v2.conf" +title UEFI ${_UEFI_ARCH} Shell v2 - For Spec. Ver. >=2.3 systems +efi /EFI/tools/shell${_SPEC_UEFI_ARCH}_v2.efi +EOF + + cat << EOF > "${ALLINONE}/loader/entries/uefi-shell-${_UEFI_ARCH}-v1.conf" +title UEFI ${_UEFI_ARCH} Shell v1 - For Spec. Ver. <2.3 systems +efi /EFI/tools/shell${_SPEC_UEFI_ARCH}_v1.efi +EOF + +} + +_prepare_grub_uefi_arch_specific_CD_files() { mkdir -p "${ALLINONE}/boot/grub" @@ -267,20 +307,13 @@ EOF rm -f "${ALLINONE}/boot/grub/grub.cfg" - mkdir -p "${ALLINONE}/EFI/boot/" - cp -f "${grub_uefi_mp}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" "${ALLINONE}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" - - unset _UEFI_ARCH - unset _SPEC_UEFI_ARCH - } -_prepare_grub_uefi_iso_files() { +_prepare_grub_uefi_CD_files() { grub_uefi_mp="$(mktemp -d /tmp/grub_uefi_mp.XXX)" mkdir -p "${ALLINONE}/boot/grub" - mkdir -p "${ALLINONE}/EFI/boot" # Create a blank image to be converted to ESP IMG dd if="/dev/zero" of="${ALLINONE}/boot/grub/grub_uefi_x86_64.bin" bs="1024" count="4096" @@ -298,8 +331,7 @@ _prepare_grub_uefi_iso_files() { mkdir -p "${grub_uefi_mp}/EFI/boot/" - _UEFI_ARCH="x86_64" - _prepare_grub_uefi_arch_specific_iso_files + _prepare_grub_uefi_arch_specific_CD_files # umount images and loop umount "${grub_uefi_mp}" @@ -444,14 +476,14 @@ EOF if [ "\${grub_platform}" == "efi" ]; then - menuentry "UEFI \${_UEFI_ARCH} Shell 2.0 - For Spec. Ver. >=2.3 systems" { + menuentry "UEFI \${_UEFI_ARCH} Shell v2 - For Spec. Ver. >=2.3 systems" { set root="\${archboot}" - chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}.efi + chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_v2.efi } - menuentry "UEFI \${_UEFI_ARCH} Shell 1.0 - For Spec. Ver. <2.3 systems" { + menuentry "UEFI \${_UEFI_ARCH} Shell v1 - For Spec. Ver. <2.3 systems" { set root="\${archboot}" - chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_old.efi + chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_v1.efi } fi @@ -470,9 +502,14 @@ _prepare_kernel_initramfs_files _download_uefi_shell_tianocore -_download_uefi_refind_sourceforge +# _download_uefi_refind_bin_sourceforge -_prepare_grub_uefi_iso_files +_prepare_uefi_gummiboot_USB_files + +_prepare_grub_uefi_CD_files + +unset _UEFI_ARCH +unset _SPEC_UEFI_ARCH # place syslinux files mv "${CORE}/tmp"/*/boot/syslinux/* "${ALLINONE}/boot/syslinux/" @@ -508,12 +545,12 @@ xorriso -as mkisofs \ # "${USBIMAGE_HELPER}" "${ALLINONE}" "${IMAGENAME}.img" > /dev/null 2>&1 if [[ -e "${WD}/${IMAGENAME_OLD}-dual.iso" ]] && [[ ! -e "${WD}/${IMAGENAME_OLD}-x86_64.iso" ]]; then - _REMOVE_i686="1" _REMOVE_x86_64="0" _UPDATE_SETUP="0" _UPDATE_UEFI_SHELL="0" _UPDATE_UEFI_REFIND="0" _UPDATE_SYSLINUX="0" _UPDATE_SYSLINUX_CONFIG="1" _UPDATE_GRUB_UEFI="0" _UPDATE_GRUB_UEFI_CONFIG="1" "${UPDATEISO_HELPER}" "${WD}/${IMAGENAME_OLD}-dual.iso" + _REMOVE_i686="1" _REMOVE_x86_64="0" _UPDATE_SETUP="0" _UPDATE_UEFI_SHELL="0" _UPDATE_UEFI_REFIND_BIN="0" _UPDATE_UEFI_GUMMIBOOT="0" _UPDATE_SYSLINUX="0" _UPDATE_SYSLINUX_CONFIG="1" _UPDATE_GRUB_UEFI="0" _UPDATE_GRUB_UEFI_CONFIG="1" "${UPDATEISO_HELPER}" "${WD}/${IMAGENAME_OLD}-dual.iso" mv "${WD}/${IMAGENAME_OLD}-dual-updated-x86_64.iso" "${WD}/${IMAGENAME_OLD}-x86_64.iso" fi if [[ -e "${WD}/${IMAGENAME_OLD}-dual.iso" ]] && [[ ! -e "${WD}/${IMAGENAME_OLD}-i686.iso" ]]; then - _REMOVE_i686="0" _REMOVE_x86_64="1" _UPDATE_SETUP="0" _UPDATE_UEFI_SHELL="0" _UPDATE_UEFI_REFIND="0" _UPDATE_SYSLINUX="0" _UPDATE_SYSLINUX_CONFIG="1" _UPDATE_GRUB_UEFI="0" _UPDATE_GRUB_UEFI_CONFIG="1" "${UPDATEISO_HELPER}" "${WD}/${IMAGENAME_OLD}-dual.iso" + _REMOVE_i686="0" _REMOVE_x86_64="1" _UPDATE_SETUP="0" _UPDATE_UEFI_SHELL="0" _UPDATE_UEFI_REFIND_BIN="0" _UPDATE_UEFI_GUMMIBOOT="0" _UPDATE_SYSLINUX="0" _UPDATE_SYSLINUX_CONFIG="1" _UPDATE_GRUB_UEFI="0" _UPDATE_GRUB_UEFI_CONFIG="1" "${UPDATEISO_HELPER}" "${WD}/${IMAGENAME_OLD}-dual.iso" mv "${WD}/${IMAGENAME_OLD}-dual-updated-i686.iso" "${WD}/${IMAGENAME_OLD}-i686.iso" fi diff --git a/usr/bin/archboot-update-iso.sh b/usr/bin/archboot-update-iso.sh index 52d421e5c..17f9ecf2a 100755 --- a/usr/bin/archboot-update-iso.sh +++ b/usr/bin/archboot-update-iso.sh @@ -7,7 +7,8 @@ [[ -z "${_UPDATE_SETUP}" ]] && _UPDATE_SETUP="1" [[ -z "${_UPDATE_UEFI_SHELL}" ]] && _UPDATE_UEFI_SHELL="1" -[[ -z "${_UPDATE_UEFI_REFIND}" ]] && _UPDATE_UEFI_REFIND="1" +[[ -z "${_UPDATE_UEFI_REFIND_BIN}" ]] && _UPDATE_UEFI_REFIND_BIN="1" +[[ -z "${_UPDATE_UEFI_GUMMIBOOT}" ]] && _UPDATE_UEFI_GUMMIBOOT="1" [[ -z "${_UPDATE_SYSLINUX}" ]] && _UPDATE_SYSLINUX="1" [[ -z "${_UPDATE_SYSLINUX_CONFIG}" ]] && _UPDATE_SYSLINUX_CONFIG="1" @@ -17,6 +18,11 @@ [[ "${_UPDATE_SYSLINUX}" == "1" ]] && _UPDATE_SYSLINUX_CONFIG="1" [[ "${_UPDATE_GRUB_UEFI}" == "1" ]] && _UPDATE_GRUB_UEFI_CONFIG="1" +[[ -z "${_UEFI_ARCH}" ]] && _UEFI_ARCH="x86_64" + +[[ "${_UEFI_ARCH}" == "x86_64" ]] && _SPEC_UEFI_ARCH="x64" +[[ "${_UEFI_ARCH}" == "i386" ]] && _SPEC_UEFI_ARCH="ia32" + ############################# _BASENAME="$(basename "${0}")" @@ -262,56 +268,56 @@ _download_uefi_shell_tianocore() { mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/" - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/shell/shellx64.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" || true - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/shell/shellx64_old.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" || true rm -rf "${_ARCHBOOT_ISO_EXT_DIR}/EFI/shell/" || true echo ## Download Tianocore UDK/EDK2 ShellBinPkg UEFI x86_64 "Full Shell" - For Spec. Ver. >=2.3 systems - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi.backup" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi.backup" || true echo - if [[ -e "${_ARCHBOOT_ISO_WD}/shellx64.efi" ]]; then - cp -f "${_ARCHBOOT_ISO_WD}/shellx64.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" + if [[ -e "${_ARCHBOOT_ISO_WD}/shellx64_v2.efi" ]]; then + cp -f "${_ARCHBOOT_ISO_WD}/shellx64_v2.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" echo else - curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi" || true + curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi" || true echo - if [[ ! "$(file "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" | grep 'executable')" ]]; then - rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" || true - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi.backup" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi" || true + if [[ ! "$(file "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" | grep 'executable')" ]]; then + rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi.backup" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi" || true fi fi - rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64.efi.backup" || true + rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v2.efi.backup" || true echo ## Download Tianocore UDK/EDK2 EdkShellBinPkg UEFI x86_64 "Full Shell" - For Spec. Ver. <2.3 systems - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi.backup" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi.backup" || true echo - if [[ -e "${_ARCHBOOT_ISO_WD}/shellx64_old.efi" ]]; then - cp -f "${_ARCHBOOT_ISO_WD}/shellx64_old.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" + if [[ -e "${_ARCHBOOT_ISO_WD}/shellx64_v1.efi" ]]; then + cp -f "${_ARCHBOOT_ISO_WD}/shellx64_v1.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" echo else - curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi" || true + curl --verbose -f -C - --ftp-pasv --retry 3 --retry-delay 3 -o "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi" || true echo - if [[ ! "$(file "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" | grep 'executable')" ]]; then - rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" || true - mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi.backup" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi" || true + if [[ ! "$(file "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" | grep 'executable')" ]]; then + rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" || true + mv "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi.backup" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi" || true fi fi - rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_old.efi.backup" || true + rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/tools/shellx64_v1.efi.backup" || true echo } -_update_uefi_refind_sourceforge() { +_update_uefi_refind_bin_sourceforge() { mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/packages/" || true @@ -323,13 +329,58 @@ _update_uefi_refind_sourceforge() { } -_update_grub_uefi_arch_specific_iso_files() { +_update_uefi_gummiboot_USB_files() { - [[ "${_UEFI_ARCH}" == "x86_64" ]] && _SPEC_UEFI_ARCH="x64" - [[ "${_UEFI_ARCH}" == "i386" ]] && _SPEC_UEFI_ARCH="ia32" + rm -rf "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/" || true + rm -rf "${_ARCHBOOT_ISO_EXT_DIR}/loader/" || true + echo + + mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot" + cp -f "/boot/efi/EFI/arch/gummiboot/gummiboot${_SPEC_UEFI_ARCH}.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" + cp -f "/boot/efi/EFI/arch/efilinux/efilinux${_SPEC_UEFI_ARCH}.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/efilinux${_SPEC_UEFI_ARCH}.efi" + echo + + mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/" + echo + + cat << EOF > "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/loader.conf" +timeout 3 +default archboot-${_UEFI_ARCH} +EOF + echo + + cat << EOF > "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/archboot-${_UEFI_ARCH}.conf" +title Arch Linux (${_UEFI_ARCH}) archboot +linux /boot/vmlinuz_${_UEFI_ARCH} +initrd /boot/initramfs_${_UEFI_ARCH}.img +options gpt loglevel=7 add_efi_memmap none=UEFI_ARCH_${_UEFI_ARCH} +EOF + echo + + cat << EOF > "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/archboot-${_UEFI_ARCH}-lts.conf" +title Arch Linux LTS (${_UEFI_ARCH}) archboot +efi /EFI/boot/efilinux${_SPEC_UEFI_ARCH}.efi +options -f \\boot\\vmlinuz_x86_64_lts gpt loglevel=7 add_efi_memmap none=UEFI_ARCH_${_UEFI_ARCH} initrd=\\boot\\initramfs_${_UEFI_ARCH}.img +EOF + echo + + cat << EOF > "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/uefi-shell-${_UEFI_ARCH}-v2.conf" +title UEFI ${_UEFI_ARCH} Shell v2 - For Spec. Ver. >=2.3 systems +efi /EFI/tools/shell${_SPEC_UEFI_ARCH}_v2.efi +EOF + echo + + cat << EOF > "${_ARCHBOOT_ISO_EXT_DIR}/loader/entries/uefi-shell-${_UEFI_ARCH}-v1.conf" +title UEFI ${_UEFI_ARCH} Shell v1 - For Spec. Ver. <2.3 systems +efi /EFI/tools/shell${_SPEC_UEFI_ARCH}_v1.efi +EOF + echo + +} + +_update_grub_uefi_arch_specific_CD_files() { rm -f "${grub_uefi_mp}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" || true - rm -f "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" || true echo rm -rf "${_ARCHBOOT_ISO_EXT_DIR}/boot/grub/${_UEFI_ARCH}-efi" || true @@ -378,17 +429,11 @@ EOF rm -f "${_ARCHBOOT_ISO_EXT_DIR}/boot/grub/grub.cfg" - mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/" - cp -f "${grub_uefi_mp}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot/boot${_SPEC_UEFI_ARCH}.efi" - echo - unset _UEFI_ARCH - unset _SPEC_UEFI_ARCH - } -_update_grub_uefi_iso_files() { +_update_grub_uefi_CD_files() { grub_uefi_mp="$(mktemp -d /tmp/grub_uefi_mp.XXX)" @@ -396,7 +441,6 @@ _update_grub_uefi_iso_files() { echo mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/boot/grub" - mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/EFI/boot" echo # Create a blank image to be converted to ESP IMG @@ -422,7 +466,7 @@ _update_grub_uefi_iso_files() { echo _UEFI_ARCH="x86_64" - _update_grub_uefi_arch_specific_iso_files + _update_grub_uefi_arch_specific_CD_files echo # umount images and loop @@ -455,7 +499,7 @@ _update_grub_uefi_iso_files() { } -_update_grub_uefi_iso_config() { +_update_grub_uefi_CD_config() { rm -f "${_ARCHBOOT_ISO_EXT_DIR}/boot/grub/grub_archboot.cfg" || true @@ -584,14 +628,14 @@ EOF if [ "\${grub_platform}" == "efi" ]; then - menuentry "UEFI \${_UEFI_ARCH} Shell 2.0 - For Spec. Ver. >=2.3 systems" { + menuentry "UEFI \${_UEFI_ARCH} Shell v2 - For Spec. Ver. >=2.3 systems" { set root="\${archboot}" - chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}.efi + chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_v2.efi } - menuentry "UEFI \${_UEFI_ARCH} Shell 1.0 - For Spec. Ver. <2.3 systems" { + menuentry "UEFI \${_UEFI_ARCH} Shell v1 - For Spec. Ver. <2.3 systems" { set root="\${archboot}" - chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_old.efi + chainloader /EFI/tools/shell\${_SPEC_UEFI_ARCH}_v1.efi } fi @@ -712,15 +756,17 @@ fi [[ "${_UPDATE_UEFI_SHELL}" == "1" ]] && _download_uefi_shell_tianocore -[[ "${_UPDATE_UEFI_REFIND}" == "1" ]] && _update_uefi_refind_sourceforge +# [[ "${_UPDATE_UEFI_REFIND_BIN}" == "1" ]] && _update_uefi_refind_bin_sourceforge + +[[ "${_UPDATE_UEFI_GUMMIBOOT}" == "1" ]] && _update_uefi_gummiboot_USB_files [[ "${_UPDATE_SYSLINUX}" == "1" ]] && _update_syslinux_iso_files [[ "${_UPDATE_SYSLINUX_CONFIG}" == "1" ]] && _update_syslinux_iso_config -[[ "${_UPDATE_GRUB_UEFI}" == "1" ]] && _update_grub_uefi_iso_files +[[ "${_UPDATE_GRUB_UEFI}" == "1" ]] && _update_grub_uefi_CD_files -[[ "${_UPDATE_GRUB_UEFI_CONFIG}" == "1" ]] && _update_grub_uefi_iso_config +[[ "${_UPDATE_GRUB_UEFI_CONFIG}" == "1" ]] && _update_grub_uefi_CD_config cd "${_ARCHBOOT_ISO_WD}/" @@ -757,12 +803,14 @@ else echo fi - +unset _UEFI_ARCH +unset _SPEC_UEFI_ARCH unset _REMOVE_i686 unset _REMOVE_x86_64 unset _UPDATE_SETUP unset _UPDATE_UEFI_SHELL -unset _UPDATE_UEFI_REFIND +unset _UPDATE_UEFI_REFIND_BIN +unset _UPDATE_UEFI_GUMMIBOOT unset _UPDATE_SYSLINUX unset _UPDATE_SYSLINUX_CONFIG unset _UPDATE_GRUB_UEFI diff --git a/usr/lib/initcpio/install/arch_pacman_depends b/usr/lib/initcpio/install/arch_pacman_depends index 3738a3d85..57418bab4 100644 --- a/usr/lib/initcpio/install/arch_pacman_depends +++ b/usr/lib/initcpio/install/arch_pacman_depends @@ -19,7 +19,7 @@ build () syslinux mtools perl gmp krb5 sqlite db dbus-core libcap fsarchiver xz librpcsecgss \ libtirpc wipe ddrescue testdisk ifplugd libdaemon wpa_actiond rfkill libgssglue icu gptfdisk \ btrfs-progs nilfs-utils linux-firmware ipw2100-fw ipw2200-fw iana-etc chntpw \ - grub-common grub-bios grub-efi-x86_64 efibootmgr file keyutils yp-tools \ + grub-common grub-bios grub-efi-x86_64 gummiboot-efi-x86_64 efibootmgr file keyutils yp-tools \ curl smartmontools dnsmasq lftp openconnect libxml2 libproxy speedtouch tcpdump nmap lua weechat \ gnutls nettle libtasn1 bind rpcbind expat progsreiserfs glib2 freetype2 libssh2 libedit \ talloc eventlog idnkit libjpeg-turbo pth gnupg libksba libassuan pinentry dirmngr gpgme ldns \ diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index 07b9ea25d..6cb908f6a 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -3507,8 +3507,18 @@ doefistub_uefi_common() { if [[ "${__CARCH}" != "${UEFI_ARCH}" ]]; then DIALOG --msgbox "EFISTUB requires Kernel and UEFI arch to match, and requires CONFIG_EFI_STUB enabled kernel. Please install matching ARCH Kernel and try again." 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 + _EFILINUX="1" + + PACKAGES="efilinux-efi-${UEFI_ARCH}" + run_pacman + PACKAGES="" + + _CONTINUE="1" else + _CONTINUE="1" + fi + + if [[ "${_CONTINUE}" == "1" ]]; then bootdev="" grubdev="" complexuuid="" @@ -3517,9 +3527,67 @@ doefistub_uefi_common() { RAID_ON_LVM="" common_bootloader_checks - _EFISTUB_KERNEL="${VMLINUZ/linux/arch}" + _EFISTUB_KERNEL="${VMLINUZ/linux/arch}.efi" + [[ "${_EFILINUX}" == "1" ]] && _EFISTUB_KERNEL="${VMLINUZ/linux/arch}" _EFISTUB_INITRAMFS="${INITRAMFS/linux/arch}" + mkdir -p "${DESTDIR}/boot/efi/EFI/arch" + + rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}" + rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" + rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img" + + cp -f "${DESTDIR}/boot/${VMLINUZ}" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}" + cp -f "${DESTDIR}/boot/${INITRAMFS}.img" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" + cp -f "${DESTDIR}/boot/${INITRAMFS}-fallback.img" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img" + + ####################### + + cat << CONFEOF > "${DESTDIR}/etc/systemd/system/efistub_copy.path" +[Unit] +Description=Copy EFISTUB Kernel and Initramfs to UEFISYS Partition + +[Path] +PathChanged=/boot/${INITRAMFS}-fallback.img +Unit=efistub_copy.service + +[Install] +WantedBy=multi-user.target +CONFEOF + + cat << CONFEOF > "${DESTDIR}/etc/systemd/system/efistub_copy.service" +[Unit] +Description=Copy EFISTUB Kernel and Initramfs to UEFISYS Partition + +[Service] +Type=oneshot +ExecStart=/bin/cp -f /boot/${VMLINUZ} /boot/efi/EFI/arch/${_EFISTUB_KERNEL} +ExecStart=/bin/cp -f /boot/${INITRAMFS}.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img +ExecStart=/bin/cp -f /boot/${INITRAMFS}-fallback.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img +CONFEOF + + chroot "${DESTDIR}" /usr/bin/systemctl enable efistub_copy.path + + if [[ "${SYSTEMD}" != "1" ]]; then + PACKAGES="incron" + run_pacman + PACKAGES="" + + cat << CONFEOF > "${DESTDIR}/usr/local/bin/efistub_copy.sh" +/bin/cp -f /boot/${VMLINUZ} /boot/efi/EFI/arch/${_EFISTUB_KERNEL} +/bin/cp -f /boot/${INITRAMFS}.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img +/bin/cp -f /boot/${INITRAMFS}-fallback.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img +CONFEOF + + cat << CONFEOF > "${DESTDIR}/etc/incron.d/efistub_copy.conf" +/boot/${INITRAMFS}-fallback.img IN_CLOSE_WRITE /usr/local/bin/efistub_copy.sh +CONFEOF + + DIALOG --msgbox "Add incrond to the DAEMONS list in /etc/rc.conf ." 0 0 + fi + + ########################### + _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}')" @@ -3546,92 +3614,57 @@ doefistub_uefi_common() { _PARAMETERS_UNMOD="root=${_rootpart} ${ROOTFLAGS} rootfstype=${ROOTFS} ${RAIDARRAYS} ${CRYPTSETUP} ro initrd=\\EFI\\arch\\${_EFISTUB_INITRAMFS}.img" _PARAMETERS_MOD=$(echo "${_PARAMETERS_UNMOD}" | sed -e 's# # #g' | sed -e 's# # #g') - mkdir -p "${DESTDIR}/boot/efi/EFI/arch" + if [[ "${_EFILINUX}" == "1" ]]; then + cat << CONFEOF > "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg" +-f \\EFI\\arch\\${_EFISTUB_KERNEL} ${_PARAMETERS_MOD} +CONFEOF + fi cat << CONFEOF > "${DESTDIR}/boot/efi/EFI/arch/linux.conf" ${_PARAMETERS_MOD} CONFEOF - cat << REFINDEOF > "${DESTDIR}/boot/efi/EFI/arch/refind_linux.conf" -"Boot with Defaults" "${_PARAMETERS_MOD}" -"Boot with fallback initramfs" "${_PARAMETERS_MOD} initrd=\\EFI\\arch\\${_EFISTUB_INITRAMFS}-fallback.img" -REFINDEOF + ################################### - rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi" - rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" - rm -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img" - - cp -f "${DESTDIR}/boot/${VMLINUZ}" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi" - cp -f "${DESTDIR}/boot/${INITRAMFS}.img" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" - cp -f "${DESTDIR}/boot/${INITRAMFS}-fallback.img" "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img" - - cat << CONFEOF > "${DESTDIR}/etc/systemd/system/efistub_copy.path" -[Unit] -Description=Copy EFISTUB Kernel and Initramfs to UEFISYS Partition - -[Path] -PathChanged=/boot/${INITRAMFS}-fallback.img -Unit=efistub_copy.service - -[Install] -WantedBy=multi-user.target -CONFEOF - - cat << CONFEOF > "${DESTDIR}/etc/systemd/system/efistub_copy.service" -[Unit] -Description=Copy EFISTUB Kernel and Initramfs to UEFISYS Partition - -[Service] -Type=oneshot -ExecStart=/bin/cp -f /boot/${VMLINUZ} /boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi -ExecStart=/bin/cp -f /boot/${INITRAMFS}.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img -ExecStart=/bin/cp -f /boot/${INITRAMFS}-fallback.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img -CONFEOF - - chroot "${DESTDIR}" /usr/bin/systemctl enable efistub_copy.path - - if [[ "${SYSTEMD}" != "1" ]]; then - PACKAGES="incron" - run_pacman - PACKAGES="" + if [[ -e "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}" ]] && [[ -e "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" ]]; then + DIALOG --msgbox "The EFISTUB Kernel and initramfs have been copied to /boot/efi/EFI/arch/${_EFISTUB_KERNEL} and /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img respectively." 0 0 - cat << CONFEOF > "${DESTDIR}/usr/local/bin/efistub_copy.sh" -/bin/cp -f /boot/${VMLINUZ} /boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi -/bin/cp -f /boot/${INITRAMFS}.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img -/bin/cp -f /boot/${INITRAMFS}-fallback.img /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img -CONFEOF - - cat << CONFEOF > "${DESTDIR}/etc/incron.d/efistub_copy.conf" -/boot/${INITRAMFS}-fallback.img IN_CLOSE_WRITE /usr/local/bin/efistub_copy.sh -CONFEOF - - DIALOG --msgbox "Add incrond to the DAEMONS list in /etc/rc.conf ." 0 0 - fi - - if [[ -e "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi" ]] && [[ -e "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img" ]]; then - # _BOOTMGR_LABEL="Arch Linux (EFISTUB)" - # _BOOTMGR_LOADER_DIR="arch" - # _BOOTMGR_LOADER_FILE="${_EFISTUB_KERNEL}.efi" - # do_uefi_bootmgr_setup - - DIALOG --msgbox "The EFISTUB Kernel and initramfs have been copied to /boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi and /boot/efi/EFI/arch/${_EFISTUB_INITRAMFS}.img respectively." 0 0 - - DIALOG --msgbox "You will now be put into the editor to edit linux.conf and refind_linux.conf . After you save your changes, exit the editor." 0 0 - geteditor || return 1 - "${EDITOR}" "${DESTDIR}/boot/efi/EFI/arch/linux.conf" - "${EDITOR}" "${DESTDIR}/boot/efi/EFI/arch/refind_linux.conf" - - # DIALOG --defaultno --yesno "Do you want to copy /boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi to /boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi .\n\nThis might be needed in some systems where efibootmgr may not work due to firmware issues." 0 0 && _UEFISYS_EFI_BOOT_DIR="1" - - # if [[ "${_UEFISYS_EFI_BOOT_DIR}" == "1" ]]; then - # mkdir -p "${DESTDIR}/boot/efi/EFI/boot" + if [[ "${_EFILINUX}" == "1" ]]; then + DIALOG --msgbox "You will now be put into the editor to edit efilinux.cfg . After you save your changes, exit the editor." 0 0 + geteditor || return 1 + "${EDITOR}" "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg" + else + # _BOOTMGR_LABEL="Arch Linux (EFISTUB)" + # _BOOTMGR_LOADER_DIR="arch" + # _BOOTMGR_LOADER_FILE="${_EFISTUB_KERNEL}" + # do_uefi_bootmgr_setup - # rm -f "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" - # rm -f "${DESTDIR}/boot/efi/EFI/boot/linux.conf" + DIALOG --msgbox "You will now be put into the editor to edit linux.conf . After you save your changes, exit the editor." 0 0 + geteditor || return 1 + "${EDITOR}" "${DESTDIR}/boot/efi/EFI/arch/linux.conf" - # cp -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}.efi" "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" - # cp -f "${DESTDIR}/boot/efi/EFI/boot/linux.conf" "${DESTDIR}/boot/efi/EFI/boot/linux.conf" - # fi + # DIALOG --defaultno --yesno "Do you want to copy /boot/efi/EFI/arch/${_EFISTUB_KERNEL} to /boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi .\n\nThis might be needed in some systems where efibootmgr may not work due to firmware issues." 0 0 && _UEFISYS_EFI_BOOT_DIR="1" + + # if [[ "${_UEFISYS_EFI_BOOT_DIR}" == "1" ]]; then + # mkdir -p "${DESTDIR}/boot/efi/EFI/boot" + + # rm -f "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" + # rm -f "${DESTDIR}/boot/efi/EFI/boot/linux.conf" + + # cp -f "${DESTDIR}/boot/efi/EFI/arch/${_EFISTUB_KERNEL}" "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" + # cp -f "${DESTDIR}/boot/efi/EFI/boot/linux.conf" "${DESTDIR}/boot/efi/EFI/boot/linux.conf" + # fi + fi + + DIALOG --menu "Select which UEFI Boot Manager to install, to provide a menu for EFISTUB kernels?" 13 55 3 \ + "GUMMIBOOT_UEFI_${UEFI_ARCH}" "Simple Text Mode ${UEFI_ARCH} UEFI Boot Manager" \ + "rEFInd_UEFI_${UEFI_ARCH}" "rEFInd ${UEFI_ARCH} UEFI Boot Manager" \ + "NONE" "No Boot Manager" 2>${ANSWER} || CANCEL=1 + case $(cat ${ANSWER}) in + "GUMMIBOOT_UEFI_${UEFI_ARCH}") dogummiboot_uefi_common ;; + "rEFInd_UEFI_${UEFI_ARCH}") dorefind_uefi_common ;; + "NONE") return 0 ;; + esac else DIALOG --msgbox "Error setting up EFISTUB kernel and initramfs in /boot/efi." 0 0 fi @@ -3655,64 +3688,97 @@ do_efistub_uefi_i686() { } +dogummiboot_uefi_common() { + + DIALOG --msgbox "Setting up gummiboot-efi-${UEFI_ARCH} now ..." 0 0 + + PACKAGES="gummiboot-efi-${UEFI_ARCH}" + run_pacman + PACKAGES="" + + if [[ "${_EFILINUX}" == "1" ]]; then + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/entries/archlinux-core-lts.conf" +title Arch Linux LTS via EFILINUX +efi /EFI/arch/efilinux/efilinux${SPEC_UEFI_ARCH}.efi +options $(cat "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg") +GUMEOF + + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/entries/archlinux-core-lts-fallback.conf" +title Arch Linux LTS via EFILINUX - fallback initramfs +efi /EFI/arch/efilinux/efilinux${SPEC_UEFI_ARCH}.efi +options $(cat "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg") initrd=\\EFI\\arch\\${_EFISTUB_INITRAMFS}-fallback.img +GUMEOF + + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/loader.conf" +timeout 3 +default archlinux-core-lts +GUMEOF + + else + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/entries/archlinux-core.conf" +title Arch Linux +linux /EFI/arch/${_EFISTUB_KERNEL} +initrd /EFI/arch/${_EFISTUB_INITRAMFS}.img +options ${_PARAMETERS_MOD} +GUMEOF + + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/entries/archlinux-core-fallback.conf" +title Arch Linux fallback initramfs +linux /EFI/arch/${_EFISTUB_KERNEL} +initrd /EFI/arch/${_EFISTUB_INITRAMFS}-fallback.img +options ${_PARAMETERS_MOD} +GUMEOF + + cat << GUMEOF > "${DESTDIR}/boot/efi/loader/loader.conf" +timeout 3 +default archlinux-core +GUMEOF + + fi + + if [[ -e "${DESTDIR}/boot/efi/EFI/arch/gummiboot/gummiboot${SPEC_UEFI_ARCH}.efi" ]]; then + _BOOTMGR_LABEL="Arch Linux (gummiboot)" + _BOOTMGR_LOADER_DIR="arch//gummiboot" + _BOOTMGR_LOADER_FILE="gummiboot${SPEC_UEFI_ARCH}.efi" + do_uefi_bootmgr_setup + + DIALOG --msgbox "gummiboot-efi-${UEFI_ARCH} has been setup successfully." 0 0 + + DIALOG --msgbox "You will now be put into the editor to edit loader.conf and gummiboot menu entry files . After you save your changes, exit the editor." 0 0 + geteditor || return 1 + + if [[ "${_EFILINUX}" == "1" ]]; then + "${EDITOR}" "${DESTDIR}/boot/efi/loader/entries/archlinux-core-lts.conf" + "${EDITOR}" "${DESTDIR}/boot/efi/loader/entries/archlinux-core-lts-fallback.conf" + else + "${EDITOR}" "${DESTDIR}/boot/efi/loader/entries/archlinux-core.conf" + "${EDITOR}" "${DESTDIR}/boot/efi/loader/entries/archlinux-core-fallback.conf" + fi + + "${EDITOR}" "${DESTDIR}/boot/efi/loader/loader.conf" + + DIALOG --defaultno --yesno "Do you want to copy /boot/efi/EFI/arch/gummiboot/gummiboot${SPEC_UEFI_ARCH}.efi to /boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi ?\n\nThis might be needed in some systems where efibootmgr may not work due to firmware issues." 0 0 && _UEFISYS_EFI_BOOT_DIR="1" + + if [[ "${_UEFISYS_EFI_BOOT_DIR}" == "1" ]]; then + mkdir -p "${DESTDIR}/boot/efi/EFI/boot" + rm -f "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" + cp -f "${DESTDIR}/boot/efi/EFI/arch/gummiboot/gummiboot${SPEC_UEFI_ARCH}.efi" "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" + fi + else + DIALOG --msgbox "Error setting up gummiboot-efi-${UEFI_ARCH}." 0 0 + fi + +} + dorefind_uefi_common() { - DIALOG --msgbox "Setting up rEFInd UEFI ${UEFI_ARCH} now ..." 0 0 + DIALOG --msgbox "Setting up refind-efi-${UEFI_ARCH} now ..." 0 0 - if [[ "${UEFI_ARCH}" == "x86_64" ]]; then - PACKAGES="refind-efi-${UEFI_ARCH}" - run_pacman - PACKAGES="" - fi + PACKAGES="refind-efi-${UEFI_ARCH}" + run_pacman + PACKAGES="" - if [[ -e "${DESTDIR}/boot/efi/EFI/arch/refind/refind${SPEC_UEFI_ARCH}.efi" ]]; then - _REFIND_SUBDIR="arch/refind" - _REFIND_SUBDIR_UEFI="arch\\refind" - else - rm -rf "/tmp"/refind-bin-* || true - rm -f "/tmp"/refind-bin-*.zip || true - - if [[ -e "/tmp/refind-bin.zip" ]]; then - _REFIND_ZIP="/tmp/refind-bin.zip" - elif [[ -e "${_MEDIA}/packages/refind-bin.zip" ]]; then - _REFIND_ZIP="${_MEDIA}/packages/refind-bin.zip" - else - DIALOG --msgbox "refind-bin.zip file not found. This file should be downloaded first, to setup rEFInd. You will now be asked to configure the network." 0 0 - donetwork - - curl -L "http://sourceforge.net/projects/refind/files/latest/download" -o "/tmp/refind-bin.zip" - - if [[ -e "/tmp/refind-bin.zip" ]]; then - _REFIND_ZIP="/tmp/refind-bin.zip" - else - DIALOG --msgbox "Setup could not download refind-bin.zip . Any issues with net connectivity?" 0 0 && return 1 - fi - fi - - if [[ -e "/usr/bin/bsdtar" ]]; then - bsdtar -C "/tmp" -xf "${_REFIND_ZIP}" - else - PACKAGES="libarchive" - run_pacman - PACKAGES="" - - LD_LIBRARY_PATH="${DESTDIR}/usr/lib:${DESTDIR}/lib" "${DESTDIR}/usr/bin/bsdtar" -C "/tmp" -xf "${_REFIND_ZIP}" - fi - - mv "/tmp"/refind-bin-* "/tmp/refind-bin-dir" - - _REFIND_SUBDIR="arch_refind" - _REFIND_SUBDIR_UEFI="arch_refind" - - mkdir -p "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}" - cp -f "/tmp/refind-bin-dir/refind/refind_${SPEC_UEFI_ARCH}.efi" "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/refind${SPEC_UEFI_ARCH}.efi" - cp -f "/tmp/refind-bin-dir/refind/refind.conf-sample" "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/refind.conf" - cp -rf "/tmp/refind-bin-dir/refind/icons" "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/icons" - cp -rf "/tmp/refind-bin-dir/docs" "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/docs" - cp -f "/tmp/refind-bin-dir"/*.txt "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/docs"/ - fi - - _REFIND_CONFIG="${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/refind.conf" + _REFIND_CONFIG="${DESTDIR}/boot/efi/EFI/arch/refind/refind.conf" sed 's|^timeout 20|timeout 0|g' -i "${_REFIND_CONFIG}" sed 's|^#resolution 1024 768|resolution 1024 768|g' -i "${_REFIND_CONFIG}" @@ -3722,19 +3788,45 @@ dorefind_uefi_common() { sed 's|^#dont_scan_dirs EFI/boot|dont_scan_dirs EFI/boot|g' -i "${_REFIND_CONFIG}" sed 's|^#max_tags 0|max_tags 0|g' -i "${_REFIND_CONFIG}" - if [[ -e "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/refind${SPEC_UEFI_ARCH}.efi" ]]; then + if [[ "${_EFILINUX}" == "1" ]]; then + cat << REFINDEOF >> "${DESTDIR}/boot/efi/EFI/arch/refind/refind.conf" + +menuentry "Arch Linux LTS via EFILINUX" { + icon /EFI/arch/refind/icons/os_arch.icns + loader /EFI/arch/efilinux/efilinux${SPEC_UEFI_ARCH}.efi + options "$(cat "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg")" +} + +menuentry "Arch Linux LTS via EFILINUX - fallback initramfs" { + icon /EFI/arch/refind/icons/os_arch.icns + loader /EFI/arch/efilinux/efilinux${SPEC_UEFI_ARCH}.efi + options "$(cat "${DESTDIR}/boot/efi/EFI/arch/efilinux/efilinux.cfg") initrd=\\EFI\\arch\\${_EFISTUB_INITRAMFS}-fallback.img" +} + +REFINDEOF + + else + cat << REFINDEOF > "${DESTDIR}/boot/efi/EFI/arch/refind_linux.conf" +"Boot with Defaults" "${_PARAMETERS_MOD}" +"Boot with fallback initramfs" "${_PARAMETERS_MOD} initrd=\\EFI\\arch\\${_EFISTUB_INITRAMFS}-fallback.img" +REFINDEOF + + fi + + if [[ -e "${DESTDIR}/boot/efi/EFI/arch/refind/refind${SPEC_UEFI_ARCH}.efi" ]]; then _BOOTMGR_LABEL="Arch Linux (rEFInd)" - _BOOTMGR_LOADER_DIR="${_REFIND_SUBDIR_UEFI}" + _BOOTMGR_LOADER_DIR="arch//refind" _BOOTMGR_LOADER_FILE="refind${SPEC_UEFI_ARCH}.efi" do_uefi_bootmgr_setup - DIALOG --msgbox "rEFInd UEFI ${UEFI_ARCH} has been setup successfully." 0 0 + DIALOG --msgbox "refind-efi-${UEFI_ARCH} has been setup successfully." 0 0 - DIALOG --msgbox "You will now be put into the editor to edit refind.conf . After you save your changes, exit the editor." 0 0 + DIALOG --msgbox "You will now be put into the editor to edit refind.conf (and maybe refind_linux.conf) . After you save your changes, exit the editor." 0 0 geteditor || return 1 "${EDITOR}" "${_REFIND_CONFIG}" + [[ "${_EFILINUX}" != "1" ]] && "${EDITOR}" "${DESTDIR}/boot/efi/EFI/arch/refind_linux.conf" - DIALOG --defaultno --yesno "Do you want to copy /boot/efi/EFI/${_REFIND_SUBDIR}/refind${SPEC_UEFI_ARCH}.efi to /boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi ?\n\nThis might be needed in some systems where efibootmgr may not work due to firmware issues." 0 0 && _UEFISYS_EFI_BOOT_DIR="1" + DIALOG --defaultno --yesno "Do you want to copy /boot/efi/EFI/arch/refind/refind${SPEC_UEFI_ARCH}.efi to /boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi ?\n\nThis might be needed in some systems where efibootmgr may not work due to firmware issues." 0 0 && _UEFISYS_EFI_BOOT_DIR="1" if [[ "${_UEFISYS_EFI_BOOT_DIR}" == "1" ]]; then mkdir -p "${DESTDIR}/boot/efi/EFI/boot" @@ -3743,32 +3835,16 @@ dorefind_uefi_common() { rm -f "${DESTDIR}/boot/efi/EFI/boot/refind.conf" rm -rf "${DESTDIR}/boot/efi/EFI/boot/icons" - cp -f "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/refind${SPEC_UEFI_ARCH}.efi" "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" + cp -f "${DESTDIR}/boot/efi/EFI/arch/refind/refind${SPEC_UEFI_ARCH}.efi" "${DESTDIR}/boot/efi/EFI/boot/boot${SPEC_UEFI_ARCH}.efi" cp -f "${_REFIND_CONFIG}" "${DESTDIR}/boot/efi/EFI/boot/refind.conf" - cp -rf "${DESTDIR}/boot/efi/EFI/${_REFIND_SUBDIR}/icons" "${DESTDIR}/boot/efi/EFI/boot/icons" + cp -rf "${DESTDIR}/boot/efi/EFI/arch/refind/icons" "${DESTDIR}/boot/efi/EFI/boot/icons" fi else - DIALOG --msgbox "Error setting up rEFInd UEFI ${UEFI_ARCH}." 0 0 + DIALOG --msgbox "Error setting up refind-efi-${UEFI_ARCH}." 0 0 fi } -dorefind_uefi_x86_64() { - - do_efistub_uefi_x86_64 - - dorefind_uefi_common - -} - -dorefind_uefi_i386() { - - do_efistub_uefi_i686 - - dorefind_uefi_common - -} - # install syslinux and run preparation prepare_syslinux() { if ! [[ -e "${DESTDIR}/usr/sbin/extlinux" || -e "${DESTDIR}/usr/bin/mcopy" ]]; then @@ -5196,10 +5272,10 @@ configure_system() { install_bootloader_uefi_x86_64() { DIALOG --menu "Which x86_64 UEFI bootloader would you like to use?" 13 55 2 \ - "rEFInd_UEFI_x86_64" "rEFInd x86_64 (supports only x86_64 EFISTUB kernels)" \ + "EFISTUB_x86_64" "Only x86_64 Kernels" \ "GRUB_UEFI_x86_64" "GRUB(2) x86_64 UEFI" 2>${ANSWER} || CANCEL=1 case $(cat ${ANSWER}) in - "rEFInd_UEFI_x86_64") dorefind_uefi_x86_64 ;; + "EFISTUB_x86_64") do_efistub_uefi_x86_64 ;; "GRUB_UEFI_x86_64") dogrub_uefi_x86_64 ;; esac @@ -5208,10 +5284,10 @@ install_bootloader_uefi_x86_64() { install_bootloader_uefi_i386() { DIALOG --menu "Which i386 UEFI bootloader would you like to use?" 13 55 2 \ - "rEFInd_UEFI_i386" "rEFInd i386 (supports only ix86 EFISTUB kernels)" \ + "EFISTUB_i686" "Only i686 Kernels" \ "GRUB_UEFI_i386" "GRUB(2) i386 UEFI" 2>${ANSWER} || CANCEL=1 case $(cat ${ANSWER}) in - "rEFInd_UEFI_i386") dorefind_uefi_i386 ;; + "EFISTUB_i686") do_efistub_uefi_i686 ;; "GRUB_UEFI_i386") dogrub_uefi_i386 ;; esac