encrypted auto install

This commit is contained in:
Ward from fusion-voyager-3 2024-01-22 22:32:48 +03:00
parent 6a5062ebc0
commit 246c7c3cc7

View File

@ -55,4 +55,55 @@ then
fi fi
else else
LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")" LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")"
wipefs -a /dev/${DISK}
# Partition the drives
parted -s -a optimal /dev/${DISK} mklabel gpt \
mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" 1537Mib 42497Mib \
mkpart "linux-home" 42497Mib 100% \
print
# add p to partition if it's nvme
if echo ${DISK} | grep -i "nvme"
then
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}p1
yes | mkfs -t ext4 /dev/${DISK}p2
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}p3
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}p4
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}p3 crypt_root
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}p4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
# Begin Mounting
mkdir -p /media/pika-install-mount
mount /dev/mapper/crypt_root /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}p2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -b /media/pika-install-mount/boot -e /media/pika-install-mount/boot/efi -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt
else
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}1
yes | mkfs -t ext4 /dev/${DISK}2
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}3
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}4
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}3 crypt_root
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
# Begin Mounting
mkdir -p /media/pika-install-mount
mount /dev/mapper/crypt_root /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -b /media/pika-install-mount/boot -e /media/pika-install-mount/boot/efi -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt
fi
fi fi