install: autodetect BIOS type

This commit is contained in:
Daniel Langbein 2021-05-13 20:39:25 +02:00
parent 30052ed04c
commit 6e5beb07b2
3 changed files with 23 additions and 5 deletions

View File

@ -2,7 +2,7 @@
_pkgname=installer _pkgname=installer
_reponame=arch _reponame=arch
pkgname="de-p1st-$_pkgname" pkgname="de-p1st-$_pkgname"
pkgver=0.1.2 pkgver=0.1.3
pkgrel=1 pkgrel=1
pkgdesc="Bash script to install Arch Linux" pkgdesc="Bash script to install Arch Linux"
arch=('any') arch=('any')

View File

@ -11,7 +11,7 @@ source /usr/lib/de-p1st-installer/block-device.sh || { exit 1; }
function check_network() { function check_network() {
echo "Sending ping to wikipedia.de ..." echo "Sending ping to wikipedia.de ..."
ping -c 1 wikipedia.de || { ping -c 1 wikipedia.de >/dev/null || {
echo "Pleas set up network access." echo "Pleas set up network access."
return 1 return 1
} }
@ -22,7 +22,7 @@ function increase_cow_space() {
# Usually not necessary! # Usually not necessary!
# make sure that we are on a live medium: # make sure that we are on a live medium:
findmnt /run/archiso/cowspace || { findmnt /run/archiso/cowspace >/dev/null || {
echo "Not on live medium, did not increase cowspace!" echo "Not on live medium, did not increase cowspace!"
return 1 return 1
} }
@ -42,8 +42,25 @@ function get_user_input() {
get_block_devices_with_size || return $? get_block_devices_with_size || return $?
get_single_choice TARGET_BLOCK_DEVICE "Select target device for installation" BLOCK_DEVICE_SIZES || return $? get_single_choice TARGET_BLOCK_DEVICE "Select target device for installation" BLOCK_DEVICE_SIZES || return $?
if [ "${BIOS_TYPE}" = "autodetect" ]; then
# Detect BIOS type: https://askubuntu.com/a/162573
# Check exit code; if 0 EFI, else BIOS.
# "-q": tell grep to output nothing
if dmesg | grep -q "EFI v"; then
echo "Detected EFI boot."
BIOS_TYPE="uefi"
else
echo "Detected BIOS boot"
BIOS_TYPE="bios"
fi
else
# Let user select BIOS type
TMP1=('uefi' 'Newer mainboards' 'bios' 'Legacy BIOS on older mainboards') TMP1=('uefi' 'Newer mainboards' 'bios' 'Legacy BIOS on older mainboards')
get_single_choice BIOS_TYPE "Select your bios type" TMP1 || return $? get_single_choice BIOS_TYPE "Select your bios type" TMP1 || return $?
fi
TMP1=('BTRFS' 'Allows snapshots and dynamic extension of the FS' 'EXT4' 'Default FS of many distributions' 'F2FS' 'Flash-Friendly-FS for SSD or NVMe') TMP1=('BTRFS' 'Allows snapshots and dynamic extension of the FS' 'EXT4' 'Default FS of many distributions' 'F2FS' 'Flash-Friendly-FS for SSD or NVMe')
get_single_choice FS "Select filesystem to use" TMP1 || return $? get_single_choice FS "Select filesystem to use" TMP1 || return $?

View File

@ -21,6 +21,7 @@ FS_CHOSEN_MOUNT_OPTIONS=('noatime')
# If not booted into the target system, these values should be set: # If not booted into the target system, these values should be set:
# CPU_VENDOR: "autodetect", "amd", "intel" or "none" # CPU_VENDOR: "autodetect", "amd", "intel" or "none"
CPU_VENDOR=autodetect CPU_VENDOR=autodetect
# BIOS_TYPE: "autodetect", "uefi" or "bios"
BIOS_TYPE=uefi BIOS_TYPE=uefi
# If set to "1", then the data, boot and luks partitions # If set to "1", then the data, boot and luks partitions