summaryrefslogtreecommitdiff
path: root/stages/first_stage.sh
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-03-17 13:33:26 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-03-17 13:33:26 +0100
commit3d4061b6cec978642f2ca9b2de9c6dd9dff5c37b (patch)
tree7b807b657fbfd96ab67c6bf0e320639428f06ab5 /stages/first_stage.sh
parent3857365127e27d5b64d5dc36d18fb4f618f9ae70 (diff)
downloadarchinstall-3d4061b6cec978642f2ca9b2de9c6dd9dff5c37b.tar
archinstall-3d4061b6cec978642f2ca9b2de9c6dd9dff5c37b.tar.zst
archinstall-3d4061b6cec978642f2ca9b2de9c6dd9dff5c37b.zip
Implement Partitioning
Diffstat (limited to 'stages/first_stage.sh')
-rw-r--r--stages/first_stage.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/stages/first_stage.sh b/stages/first_stage.sh
index fe5e1bb..8b91c9e 100644
--- a/stages/first_stage.sh
+++ b/stages/first_stage.sh
@@ -24,3 +24,69 @@ set -e
echo "Entering first_stage.sh - OK"
+
+
+# Check bootmode
+
+if [ -d "/sys/firmware/efi/efivars" ]; then
+ export boot_mode="uefi"
+ echo "Booted with UEFI"
+else
+ export boot_mode="bios"
+ echo "Booted with legacy boot / BIOS"
+fi
+
+
+# Partition the disk
+
+if [ "$boot_mode" == "unknown" ]; then
+ echo "boot_mode unknown! - FAILED"
+ exit 1
+fi
+
+if [ "$path_to_disk" == "/dev/null" ]; then
+ echo "path_to_disk has still default value! - FAILED"
+ exit 1
+fi
+
+if [ "$boot_mode" == "uefi" ]; then
+ echo "Partitioning for UEFI mode."
+ wipefs -a $path_to_disk # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $path_to_disk << EOF
+g
+n
+1
+
++512M
+n
+2
+
++200M
+n
+3
+
+
+p
+w
+EOF
+
+ echo "Partitioned disk for UEFI/GPT- OK"
+elif [ "$boot_mode" == "bios" ]; then
+ echo "Partitioning for BIOS mode."
+ wipefs -a $path_to_disk # make sure that fdisk does not ask for removing
+ # signatures which breaks the script
+ fdisk $path_to_disk << EOF
+o
+n
+p
+1
+
+
+p
+w
+EOF
+
+ echo "Partitioned disk for BIOS/MBR - OK"
+else
+fi