Explorar o código

remove pvalues + add cryptsetup without keyfile

Noah Vogt hai 1 ano
pai
achega
28dbf3675d
Modificáronse 2 ficheiros con 21 adicións e 15 borrados
  1. 14 6
      arch.sh
  2. 7 9
      chroot.sh

+ 14 - 6
arch.sh

@@ -16,7 +16,6 @@ dialog --no-cancel --inputbox "Enter the drive you want do install Arch Linux fo
 test -d /sys/firmware/efi/efivars || error_exit "Error: Please boot in UEFI mode. No efi vars detected."
 
 DRIVE=$(cat drive)
-PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
 
 cat <<EOF | fdisk -W always /dev/"${DRIVE}"
 g
@@ -37,15 +36,24 @@ w
 EOF
 partprobe
 
-mkfs.fat -F32 /dev/"${DRIVE}${PVALUE}"1
-yes | mkfs.ext4 /dev/"${DRIVE}${PVALUE}"2
-mount /dev/"${DRIVE}${PVALUE}"2 /mnt
+mkfs.fat -F32 /dev/"$DRIVE"1
+
+while true; do
+    cryptsetup luksFormat --type luks1 /dev/"$DRIVE"2 && break
+done
+
+while true; do
+    cryptsetup open /dev/"$DRIVE"2 cryptroot && break
+done
+
+yes | mkfs.ext4 /dev/mapper/cryptroot
+mount /dev/mapper/cryptroot /mnt
 mkdir -p /mnt/efi
-mount /dev/"$DRIVE$PVALUE"1 /mnt/efi
+mount /dev/"$DRIVE"1 /mnt/efi
 
 pacman -Sy --noconfirm archlinux-keyring
 
-pacstrap /mnt base linux networkmanager sbctl amd-ucode efibootmgr
+pacstrap /mnt base linux networkmanager sbctl amd-ucode efibootmgr cryptsetup
 
 genfstab -U /mnt >> /mnt/etc/fstab
 mv drive /mnt

+ 7 - 9
chroot.sh

@@ -25,8 +25,12 @@ systemctl enable NetworkManager
 mkdir -p /efi/EFI/Linux
 test -d /efi/EFI || error_exit "Error: EFI partition could not be mounted correctly."
 
-# cat /proc/cmdline > /etc/kernel/cmdline
-echo "BOOT_IMAGE=/boot/vmlinuz-linux root=/dev/sda2 rw loglevel=3 quiet" > /etc/kernel/cmdline
+sed -i 's/block filesystems/block encrypt filesystems/' /etc/mkinitcpio.conf
+mkinitcpio -p linux
+
+root_uuid="$(grep UUID /etc/fstab | sed 's/^UUID=//; s/\s\/.*$//')"
+
+echo "BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=$root_uuid rw cryptdevice=/dev/sda2:cryptroot loglevel=0 quiet udev.log_level=3" > /etc/kernel/cmdline
 chmod +w /etc/kernel/cmdline
 
 sb_status="$(sbctl status)"
@@ -51,12 +55,6 @@ efibootmgr --create \
     --label "videopc signed efi bundle" \
     --loader /EFI/Linux/ArchBundle.efi
 
-pacman -S linux
-
-# sed -i 's/^\s*GRUB_TIMEOUT=5/GRUB_TIMEOUT=0/' /etc/default/grub
-# sed -i 's/^\s*GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"/GRUB_CMDLINE_LINUX_DEFAULT="loglevel=0 quiet udev.log_level=3"/' /etc/default/grub
-
-# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=grub /dev/"${DRIVE}" --recheck
-# grub-mkconfig -o /boot/grub/grub.cfg
+mkinitcpio -p linux
 
 rm drive