forked from lubiland/hardware-setup
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
851 B
Bash
37 lines
851 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# / 1990GB /dev/sda1 & /dev/sdb1 btrfs raid1
|
|
# /boot 2GB /dev/md0
|
|
# /boot/efi 1GB /dev/sda3 || /dev/sdb3
|
|
# free 7GB
|
|
|
|
chroot="$1"
|
|
|
|
# encrypt and unlock the root partitions
|
|
echo -n 'Enter LUKS password: '
|
|
read -s root_pwd
|
|
echo #to indicate progress after password prompt
|
|
for root in "sda1" "sdb1"; do
|
|
echo -n $root_pwd | cryptsetup -q luksFormat "/dev/$root"
|
|
echo -n $root_pwd | cryptsetup open --type luks "/dev/$root" "root-unlocked-$root"
|
|
done
|
|
unset root_pwd
|
|
|
|
|
|
# root device btrfs raid1
|
|
mkfs.btrfs /dev/sda1
|
|
mount /dev/sda1 "$chroot"
|
|
btrfs device add /dev/sdb1 "$chroot" -f
|
|
btrfs balance start -dconvert=raid1 -mconvert=raid1 "$chroot"
|
|
|
|
# boot device ext4
|
|
mkfs.ext4 "$boot"
|
|
mkdir "$chroot/boot"
|
|
mount "$boot" "$chroot/boot"
|
|
|
|
# esp device FAT
|
|
mkfs.fat "$esp"
|
|
mkdir "$chroot/boot/efi"
|
|
mount "$esp" "$chroot/boot/efi"
|