@@ -292,23 +292,35 @@ function configure_user() {
292292
293293function configure_grub() {
294294 echo " ==> Install and configure bootloader."
295+
295296 ROOT_UUID=$( blkid -s UUID -o value " $ROOT " )
296297
297298 # Configure kernel parameters for LUKS
298299 sed -i " s|^GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX=\" cryptdevice=UUID=${ROOT_UUID} :cryptroot root=/dev/mapper/cryptroot\" |" /mnt/etc/default/grub
300+
301+ # Silent boot
302+ sed -i ' s/^#GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/' /mnt/etc/default/grub
303+ sed -i ' s/^#GRUB_TIMEOUT_STYLE=.*/GRUB_TIMEOUT_STYLE=hidden/' /mnt/etc/default/grub
304+ sed -i ' s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3"/' /mnt/etc/default/grub
305+
299306 # Enable encrypt hook
300307 sed -i ' s/^HOOKS=.*/HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)/' /mnt/etc/mkinitcpio.conf
301308
302- echo ' GRUB_ENABLE_CRYPTODISK=y' >> /mnt/etc/default/grub
303309 arch-chroot /mnt mkinitcpio -P & > /dev/null
304- arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB & > /dev/null
305310
311+ # Required temporarily for grub-install with encrypted root
312+ echo ' GRUB_ENABLE_CRYPTODISK=y' >> /mnt/etc/default/grub
313+
314+ arch-chroot /mnt grub-install \
315+ --target=x86_64-efi \
316+ --efi-directory=/boot/efi \
317+ --bootloader-id=GRUB \
318+ & > /dev/null
319+
320+ # Remove it to avoid double password prompt
306321 sed -i ' /GRUB_ENABLE_CRYPTODISK/d' /mnt/etc/default/grub
307- sed -i " s/timeout=5/timeout=0/" /mnt/boot/grub/grub.cfg
308- sed -i " s/echo 'Loading Linux linux ...'//" /mnt/boot/grub/grub.cfg
309- sed -i " s/echo 'Loading initial ramdisk ...'//" /mnt/boot/grub/grub.cfg
310- sed -i " s/loglevel=3 quiet/quiet loglevel=0 rd.systemd.show_status=auto rd.udev.log_level=3/" /mnt/boot/grub/grub.cfg
311322
323+ # Generate final config
312324 arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg & > /dev/null
313325}
314326
0 commit comments