summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-01-12 17:40:15 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-01-12 17:40:15 +0100
commit2f6a6e43c47a345ca72028177cea92e7307cebff (patch)
treedf794f83727366257c892a2c47bca472e6b90702
parentb71ec259f10635f1fb907caa8076bbc2710adf02 (diff)
downloadarchinstall-2f6a6e43c47a345ca72028177cea92e7307cebff.tar
archinstall-2f6a6e43c47a345ca72028177cea92e7307cebff.tar.zst
archinstall-2f6a6e43c47a345ca72028177cea92e7307cebff.zip
First version of BIOS boot.
-rw-r--r--README.md2
-rw-r--r--stages/first_stage.sh13
-rw-r--r--stages/second_stage.sh2
-rw-r--r--util/create_filesystems.sh22
-rw-r--r--util/install_bootloader.sh23
-rw-r--r--util/mount_filesystems.sh7
-rw-r--r--util/partition_disk.sh28
-rw-r--r--util/unmount_filesystems.sh4
8 files changed, 74 insertions, 27 deletions
diff --git a/README.md b/README.md
index 9a3ed39..a49cd5c 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,6 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s
(Highest priority first)
- [ ] Support BIOS systems
-- [ ] Use LVM
- [ ] Create swap partition
- [ ] Enable suspension to disk
- [ ] Optimize mirrorlist
@@ -47,6 +46,7 @@ Execute 'loadkeys de-latin1' after booting to live environment, if you want to s
- [ ] Provide recommended package lists
- [ ] Set a beautiful theme
- [ ] Support english localization
+- [ ] Use LVM
- [ ] Package for the AUR
diff --git a/stages/first_stage.sh b/stages/first_stage.sh
index 037d554..cdf661e 100644
--- a/stages/first_stage.sh
+++ b/stages/first_stage.sh
@@ -38,9 +38,6 @@ python -u $REPOSITORY_PATH/util/write_config.py $CONFIG_FILE_PATH
export disk=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "disk")
export disk_path=/dev/$disk
-export efi_partition_path="${disk_path}1"
-export boot_partition_path="${disk_path}2"
-export main_partition_path="${disk_path}3"
export hostname=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname")
export desktop=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop")
export admin_username=$(python -u $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username")
@@ -52,17 +49,21 @@ bash confirm_installation.sh $disk
if [ "$(bash check_bootmode.sh)" == "Booted with UEFI" ];then
echo "Booted with UEFI - OK"
export boot_mode="UEFI"
+ export efi_partition_path="${disk_path}1"
+ export boot_partition_path="${disk_path}2"
+ export main_partition_path="${disk_path}3"
elif [ "$(bash check_bootmode.sh)" == "Booted with legacy boot / BIOS" ];then
echo "Booted with BIOS - OK"
export boot_mode="BIOS"
+ export efi_partition_path="/dev/null"
+ export boot_partition_path="/dev/null"
+ export main_partition_path="${disk_path}1"
else
echo "Unknown boot mode - FAILED"
exit
fi
-exit
-
-bash partition_disk.sh $disk_path
+bash partition_disk.sh $disk_path $boot_mode
if [ $system_encryption == "yes" ];then
bash format_crypto_partition.sh $main_partition_path $DEFAULT_PASSWORD
diff --git a/stages/second_stage.sh b/stages/second_stage.sh
index c2c0b92..30dc495 100644
--- a/stages/second_stage.sh
+++ b/stages/second_stage.sh
@@ -33,6 +33,6 @@ bash configure_initramfs.sh
bash configure_users.sh $admin_username $DEFAULT_PASSWORD
-bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path
+bash install_bootloader.sh $efi_partition_path $system_encryption $main_partition_path $boot_mode
bash configure_desktop.sh
diff --git a/util/create_filesystems.sh b/util/create_filesystems.sh
index 972eefd..917363e 100644
--- a/util/create_filesystems.sh
+++ b/util/create_filesystems.sh
@@ -18,15 +18,25 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-efi_partition_path=$1 # e.g. /dev/sda1
-boot_partition_path=$2 # e.g. /dev/sda2
+efi_partition_path=$1 # e.g. /dev/sda1 or /dev/null if not needed
+boot_partition_path=$2 # e.g. /dev/sda2 or /dev/null if not needed
root_partition_path=$3 # e.g. /dev/sda3 or /dev/SystemVolumeGroup/root
-mkfs.fat -F32 $efi_partition_path
-fatlabel $efi_partition_path "EFI"
-mkfs.ext4 $boot_partition_path
-e2label $boot_partition_path "BOOT"
+if [ "$efi_partition_path" != "/dev/null" ]; then # if efi partition is needed
+ echo "EFI partition needed."
+ mkfs.fat -F32 $efi_partition_path
+ fatlabel $efi_partition_path "EFI"
+else
+ echo "EFI partition not needed."
+fi
+if [ "$boot_partition_path" != "/dev/null" ]; then # if boot partition is needed
+ echo "BOOT partition needed."
+ mkfs.ext4 $boot_partition_path
+ e2label $boot_partition_path "BOOT"
+else
+ echo "BOOT partition not needed."
+fi
mkfs.ext4 $root_partition_path
e2label $root_partition_path "ROOT"
diff --git a/util/install_bootloader.sh b/util/install_bootloader.sh
index 3f63f64..78ca49b 100644
--- a/util/install_bootloader.sh
+++ b/util/install_bootloader.sh
@@ -21,11 +21,19 @@
efi_partition_path=$1
system_encryption=$2
main_partition_path=$3
-
-
-mount $efi_partition_path /mnt
-grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \
---removable
+boot_mode=$4 # "UEFI" or "BIOS"
+
+
+if [ "$boot_mode" == "UEFI" ]; then
+ mount $efi_partition_path /mnt
+ grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=GRUB \
+ --removable
+elif [ "$boot_mode" == "BIOS" ]; then
+ grub-install --target=i386-pc $disk_path
+else
+ echo "Unknown boot mode - FAILED"
+ exit
+fi
if [ $system_encryption == "yes" ];then
@@ -41,6 +49,9 @@ if [ $system_encryption == "yes" ];then
fi
grub-mkconfig -o /boot/grub/grub.cfg
-umount $efi_partition_path
+
+if [ "$boot_mode" == "UEFI" ];then
+ umount $efi_partition_path
+fi
echo "Installed bootloader - OK"
diff --git a/util/mount_filesystems.sh b/util/mount_filesystems.sh
index f24421b..75bbb14 100644
--- a/util/mount_filesystems.sh
+++ b/util/mount_filesystems.sh
@@ -23,7 +23,10 @@ root_partition_path=$2
mount $root_partition_path /mnt
-mkdir /mnt/boot
-mount $boot_partition_path /mnt/boot
+
+if [ "$boot_partition_path" != "/dev/null" ];then
+ mkdir /mnt/boot
+ mount $boot_partition_path /mnt/boot
+fi
echo "Mounted filesystems - OK"
diff --git a/util/partition_disk.sh b/util/partition_disk.sh
index fcad5b9..6164d1b 100644
--- a/util/partition_disk.sh
+++ b/util/partition_disk.sh
@@ -19,11 +19,13 @@
disk_path=$1 # e.g. /dev/sda
+boot_mode=$2 # "UEFI" or "BIOS"
-wipefs -a $disk_path # make sure that fdisk does not ask for removing
- # signatures which breaks the script
-fdisk $disk_path << EOF
+if [ "$boot_mode" == "UEFI" ]; then
+ wipefs -a $disk_path # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $disk_path << EOF
g
n
1
@@ -41,4 +43,22 @@ p
w
EOF
-echo "Partitioned disk - OK"
+ echo "Partitioned disk for UEFI/GPT- OK"
+elif [ "$boot_mode" == "BIOS" ]; then
+ wipefs -a $disk_path # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $disk_path << EOF
+o
+n
+p
+1
+
+
+p
+w
+EOF
+
+ echo "Partitioned disk for BIOS/MBR - OK"
+else
+
+fi
diff --git a/util/unmount_filesystems.sh b/util/unmount_filesystems.sh
index 6ccce3b..0980e5a 100644
--- a/util/unmount_filesystems.sh
+++ b/util/unmount_filesystems.sh
@@ -23,7 +23,9 @@ root_partition_path=$2
cd /root
-umount $boot_partition_path
+if [ "$boot_partition_path" != "/dev/null" ];then
+ umount $boot_partition_path
+fi
umount $root_partition_path
echo "Unmounted filesystems - OK"