summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Romero <blake@blkrom.com>2024-04-02 20:04:21 +0100
committerBlake Romero <blake@blkrom.com>2024-04-02 20:04:21 +0100
commitfced013f8e426c54620749ec8a5a7d0b84ea1844 (patch)
tree179ecb22e759ccf2a7205fc0ac5b931d2504861b
parentaa288bb26dc4dda622689429080a51b46231e8e7 (diff)
Add bios/uefi installer option & update confirmation prompt
-rw-r--r--README3
-rwxr-xr-xinstall-artix.sh33
2 files changed, 30 insertions, 6 deletions
diff --git a/README b/README
index bbbff76..3a6afd1 100644
--- a/README
+++ b/README
@@ -41,6 +41,9 @@ CONFIGURATION:
- boot_size: defaults to 512M. Can be overwritten
e.g: 'boot_size=1G'.
+- firmware: install for uefi or bios systems
+ e.g: 'firmware=uefi'.
+
- timezone: a timezone (defined in '/usr/share/zoneinfo/').
- locale: a locale (defined in '/etc/locale.gen').
- user: the main user of the system.
diff --git a/install-artix.sh b/install-artix.sh
index b398ef1..1511af1 100755
--- a/install-artix.sh
+++ b/install-artix.sh
@@ -10,6 +10,7 @@ boot="${drive}1"
swap="${drive}2"
root="${drive}3"
swap_size=auto
+firmware=bios
# System
timezone=Europe/London
@@ -71,18 +72,37 @@ ram_gb=$(bc <<< "${ram_kB} / 1000^2")
[[ -z "${boot_size}" ]] && boot_size=512M
# Set boot type
-boot_type="BIOS Boot"
-[ -d /sys/firmware/efi/efivars/ ] && boot_type=U
+if [[ $firmware == bios ]]; then
+ boot_type="BIOS Boot"
+else
+ if [[ ! -d /sys/firmware/efi/efivars/ ]]; then
+ echo "Error EFI is not supported on this machine"
+ exit
+ fi
+ boot_type=U
+fi
# Request confirmation
+echo "Selected drive: "
+df -h ${drive}
+
+features=""
+[[ $encrypt == true ]] && features+="encrypt "
+[[ $arch_support == true ]] && features+="arch_support "
+[[ $enable_aur == true ]] && features+="enable_aur "
+[[ $autologin == true ]] && features+="autologin "
+
+drive_size=$(df -h "${drive}" | awk 'NR==2 {print $2}')
echo "
================ CONFIRM INSTALLATION ================
-Drive: ${drive}
+Drive: ${drive} (size: ${drive_size})
BOOT Partition: ${boot}, Size: ${boot_size}
SWAP Partition: ${swap}, Size: ${swap_size}
ROOT Partition: ${root}, Size: MAX
+Firmware: ${firmware}
------------------------------------------------------
-!!! CAUTION: all data from ${drive} will be erased !!!
+Features: ${features}
+!!! CAUTION: ALL data from ${drive} will be erased !!!
------------------------------------------------------"
echo "Are you sure you want install?"
unset input
@@ -119,7 +139,7 @@ mkswap -L SWAP "${swap}"
swapon "${swap}"
# Make BOOT filesystem
-if [ -d /sys/firmware/efi/efivars/ ]; then
+if [[ $firmware == uefi ]]; then
mkfs.fat -n BOOT -F 32 "${boot}"
else
mkfs.ext4 -qL BOOT "${boot}"
@@ -265,11 +285,12 @@ if [[ "${encrypt}" == true ]]; then
fi
# install grub
-if [ -d /sys/firmware/efi/efivars/ ]; then
+if [[ $firmware == uefi ]]; then
grub_options="--target=x86_64-efi --efi-directory=/boot --bootloader-id=artix"
else
grub_options="--recheck ${drive}"
fi
+
artix-chroot /mnt bash -c "grub-install ${grub_options}"
artix-chroot /mnt bash -c "grub-mkconfig -o /boot/grub/grub.cfg"