diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-03-21 14:58:48 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-03-21 14:58:48 +0100 |
commit | b4319a49217e69ad9c2e31199ba52c25b4d1bb7a (patch) | |
tree | 4ba24d1c651b9795f38c2615f6a0fc07f8d5c30d | |
parent | 988c86ddc26b329263f3afd3ae844063c234777c (diff) | |
download | archinstall-b4319a49217e69ad9c2e31199ba52c25b4d1bb7a.tar archinstall-b4319a49217e69ad9c2e31199ba52c25b4d1bb7a.tar.zst archinstall-b4319a49217e69ad9c2e31199ba52c25b4d1bb7a.zip |
Implement Formatting and Mounting for LUKS
-rw-r--r-- | archinstall.sh | 2 | ||||
-rw-r--r-- | stages/first_stage.sh | 35 |
2 files changed, 31 insertions, 6 deletions
diff --git a/archinstall.sh b/archinstall.sh index 37b4118..732fdd6 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -98,6 +98,7 @@ export -f print_ok function print_failed () { # ref. https://en.wikipedia.org/wiki/ANSI_escape_code printf "\033[m[ \033[31mFAILED\033[m ] $1\n" + exit 7 } export -f print_failed @@ -108,7 +109,6 @@ if ping -w $INTERNET_TEST_PING_TIMEOUT -c 1 $INTERNET_TEST_SERVER; then print_ok "Internet connection is ready" else print_failed "Could not reach INTERNET_TEST_SERVER '$INTERNET_TEST_SERVER'" - exit 1 fi diff --git a/stages/first_stage.sh b/stages/first_stage.sh index b7a45b1..302192b 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -44,7 +44,6 @@ fi if [ "$path_to_disk" == "/dev/null" ]; then # check if a disk is selected print_failed "path_to_disk variable has still default value '/dev/null'" - exit 1 fi if [ "$boot_mode" == "uefi" ]; then @@ -142,15 +141,41 @@ elif [ "$luks_encryption" == "yes" ];then print_ok "Formatting for disk encryption and bios/mbr ..." - print_failed "Sorry, encryption is not ready to use" - exit 1 ### + # root partition + echo -n "$DEFAULT_PASSWORD" | cryptsetup luksFormat ${path_to_disk}2 - + echo -n "$DEFAULT_PASSWORD" | cryptsetup open ${path_to_disk}2 main - + mkfs.ext4 /dev/mapper/main + e2label /dev/mapper/main "root" + mount /dev/mapper/main /mnt + + # boot partition + mkfs.ext4 ${path_to_disk}1 + e2label ${path_to_disk}1 "boot" + mkdir /mnt/boot + mount ${path_to_disk}1 /mnt/boot elif [ "$boot_mode" == "uefi" ];then print_ok "Formatting for disk encryption and uefi/gpt ..." - print_failed "Sorry, encryption is not ready to use" - exit 1 ### + # root partition + echo -n "$DEFAULT_PASSWORD" | cryptsetup luksFormat ${path_to_disk}3 - + echo -n "$DEFAULT_PASSWORD" | cryptsetup open ${path_to_disk}3 main - + mkfs.ext4 /dev/mapper/main + e2label /dev/mapper/main "root" + mount /dev/mapper/main /mnt + + # boot partition + mkfs.ext4 ${path_to_disk}2 + e2label ${path_to_disk}2 "boot" + mkdir /mnt/boot + mount ${path_to_disk}2 /mnt/boot + + # efi partition + mkfs.fat -F32 ${path_to_disk}1 + fatlabel ${path_to_disk}1 "efi" + mkdir /mnt/mnt + mount ${path_to_disk}1 /mnt/mnt fi |