feat: add lvm support
This commit is contained in:
parent
1704b08bb9
commit
af8bbde6df
@ -24,7 +24,7 @@ confirmation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print-break() {
|
print-break() {
|
||||||
local green=
|
local green
|
||||||
green="$(tput setaf 2)"
|
green="$(tput setaf 2)"
|
||||||
local reset
|
local reset
|
||||||
reset="$(tput sgr0)"
|
reset="$(tput sgr0)"
|
||||||
@ -283,44 +283,32 @@ main() {
|
|||||||
fi
|
fi
|
||||||
printf "Writing new partitions to %s\n" "${i_selected_disk}" >&2
|
printf "Writing new partitions to %s\n" "${i_selected_disk}" >&2
|
||||||
partition-disk "${selected_disk}"
|
partition-disk "${selected_disk}"
|
||||||
printf "Successfully wrote partitions to %s\n" "${i_selected_disk}" >&2
|
|
||||||
local boot_partion="${selected_disk}${DISK_PARTITION_LETTER}${BOOT_PARTITION_NUMBER}"
|
local boot_partion="${selected_disk}${DISK_PARTITION_LETTER}${BOOT_PARTITION_NUMBER}"
|
||||||
local root_partition="${selected_disk}${DISK_PARTITION_LETTER}${ROOT_PARTITION_NUMBER}"
|
local root_partition="${selected_disk}${DISK_PARTITION_LETTER}${ROOT_PARTITION_NUMBER}"
|
||||||
|
mkfs.vfat -F32 -n EFI "${boot_partion}"
|
||||||
|
printf "Successfully wrote partitions to %s\n" "${i_selected_disk}" >&2
|
||||||
print-break
|
print-break
|
||||||
|
|
||||||
print-title "Partition Encryption"
|
print-title "Partition Encryption"
|
||||||
printf "Encrypting %s\n" "$(important "${root_partition}")" >&2
|
printf "Encrypting %s\n" "$(important "${root_partition}")" >&2
|
||||||
cryptsetup -y -v luksFormat "${root_partition}" || exit
|
cryptsetup -y -v luksFormat "${root_partition}" || exit
|
||||||
printf "Opening encrypted device %s\n" \
|
printf "Opening encrypted device %s\n" \
|
||||||
"${i_selected_disk}" >&2
|
"$(important "${root_partition}")" >&2
|
||||||
cryptsetup open "${root_partition}" cryptroot || exit
|
cryptsetup open "${root_partition}" cryptroot || exit
|
||||||
mkfs.fat -F 32 "${boot_partion}"
|
printf "Configuring LVM\n" >&2
|
||||||
mkfs.ext4 "/dev/mapper/cryptroot"
|
pvcreate /dev/mapper/cryptroot
|
||||||
|
vgcreate vg0 /dev/mapper/cryptroot
|
||||||
|
lvcreate --size 16G vg0 --name swap
|
||||||
|
lvcreate -l +100%FREE vg0 --name root
|
||||||
|
printf "Writing filesystems\n" >&2
|
||||||
|
mkfs.ext4 -L root "/dev/mapper/vg0-root"
|
||||||
|
mkswap /dev/mapper/vg0-swap
|
||||||
print-break
|
print-break
|
||||||
|
|
||||||
print-title "Configure Swap"
|
|
||||||
local mem_amount_kb
|
|
||||||
mem_amount_kb="$(grep MemTotal /proc/meminfo | tr -s " " | cut -d " " -f2)"
|
|
||||||
mem_amount_mb=$((mem_amount_kb / 1024))
|
|
||||||
# Space to swap is taken from fedora guidelines:
|
|
||||||
# https://docs.fedoraproject.org/en-US/Fedora/22/html/Installation_Guide/sect-installation-gui-manual-partitioning-recommended.html
|
|
||||||
if ((mem_amount_mb < 2048)); then
|
|
||||||
mem_amount_kb=$((mem_amount_kb * 3 / 1024))
|
|
||||||
elif ((mem_amount_mb < 8192)); then
|
|
||||||
mem_amount_kb=$((mem_amount_kb * 2 / 1024))
|
|
||||||
elif ((mem_amount_mb < 65536)); then
|
|
||||||
mem_amount_kb=$((mem_amount_kb * 3 / 2 / 1024))
|
|
||||||
fi
|
|
||||||
printf "Creating swap file with memory amount: %s mebibytes\n" "$(important "${mem_amount_kb}")"
|
|
||||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count="${mem_amount_kb}" status=progress
|
|
||||||
chmod 600 /mnt/swapfile
|
|
||||||
mkswap /mnt/swapfile
|
|
||||||
swapon /mnt/swapfile
|
|
||||||
printf "Finished creating swapfile\n" >&2
|
|
||||||
|
|
||||||
print-title "Install Arch Into Encrypted Volume"
|
print-title "Install Arch Into Encrypted Volume"
|
||||||
printf "Mounting Needed Directores\n" >&2
|
printf "Mounting Needed Directores\n" >&2
|
||||||
mount /dev/mapper/cryptroot /mnt
|
mount /dev/mapper/vg0-root /mnt
|
||||||
|
swapon /dev/mapper/vg0-swap
|
||||||
mkdir /mnt/boot
|
mkdir /mnt/boot
|
||||||
mount "${boot_partion}" /mnt/boot
|
mount "${boot_partion}" /mnt/boot
|
||||||
printf "Doing Pacstrap\n" >&2
|
printf "Doing Pacstrap\n" >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user