chroot.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. while true; do
  3. passwd && break
  4. done
  5. TZuser=$(cat tzfinal.tmp)
  6. DRIVE=$(cat drive)
  7. PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
  8. echo KEYMAP=de_CH-latin1 > /etc/vconsole.conf
  9. ln -sf /usr/share/zoneinfo/"$TZuser" /etc/localtime
  10. hwclock --systohc
  11. echo "LANG=en_GB.UTF-8" >> /etc/locale.conf
  12. echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen
  13. locale-gen
  14. pacman --noconfirm --needed -S networkmanager
  15. systemctl enable NetworkManager
  16. dd bs=512 count=4 if=/dev/urandom of=/crypto_keyfile.bin
  17. while true; do
  18. cryptsetup luksAddKey /dev/"${DRIVE}${PVALUE}2" /crypto_keyfile.bin && break
  19. done
  20. chmod 000 /crypto_keyfile.bin
  21. sed -i 's/FILES=()/FILES=(\/crypto_keyfile.bin)/' /etc/mkinitcpio.conf
  22. sed -i 's/block filesystems/block encrypt filesystems/' /etc/mkinitcpio.conf
  23. mkinitcpio -P
  24. pacman --noconfirm --needed -S grub
  25. sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=\/dev\/${DRIVE}${PVALUE}2:cryptroot\"/" /etc/default/grub
  26. sed -i 's/#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/' /etc/default/grub
  27. echo "swap /dev/${DRIVE}${PVALUE}1 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> /etc/crypttab
  28. grub-install --target=i386-pc /dev/"${DRIVE}" --recheck
  29. grub-mkconfig -o /boot/grub/grub.cfg
  30. rm drive tzfinal.tmp