# Cryptsetup wrapper.
function hydra_cryptsetup {
if [ ! -z "$1" ] && [ -b "$1" ]; then
- hydra_sudo_run cryptsetup --cipher aes-xts-plain64:sha256 --key-size 512 --hash sha512 --iter-time 5000 --use-random luksFormat $1
+ hydra_sudo_run cryptsetup --cipher aes-xts-plain64:sha256 --key-size 512 --hash sha512 --iter-time 5000 --use-random -y -q luksFormat $1
fi
}
fi
fi
-# Grub.
-if [ "$grub" == "y" ]; then
- if [ "$encrypt" != "y" ]; then
- echo "Boot device setup..."
- hydra_sudo_run mkfs.ext4 $boot_device
- hydra_sudo_run mount $boot_device $WORK/boot
- echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null
- fi
-
- echo "Setting up GRUB..."
- $APT_INSTALL grub-pc -y
-
- if [ "$encrypt" == "y" ]; then
- echo '' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
- echo '# Full Disk Encryption Support' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
- echo 'GRUB_ENABLE_CRYPTODISK=y' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
- hydra_sudo_run chroot $WORK/ update-grub
- hydra_sudo_run chroot $WORK/ grub-install $device
- fi
-fi
-
# Kernel.
echo "Installing kernel..."
cat <<-EOF | $SUDO tee $WORK/etc/initramfs-tools/modules > /dev/null
echo "Creating initramfs..."
hydra_sudo_run chroot $WORK update-initramfs -v -u
+# Grub.
+if [ "$grub" == "y" ]; then
+ if [ "$encrypt" != "y" ]; then
+ echo "Boot device setup..."
+ hydra_sudo_run mkfs.ext4 $boot_device
+ hydra_sudo_run mount $boot_device $WORK/boot
+ echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null
+ fi
+
+ echo "Setting up GRUB..."
+ $APT_INSTALL grub-pc -y
+
+ if [ "$encrypt" == "y" ]; then
+ echo '' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
+ echo '# Full Disk Encryption Support' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
+ echo 'GRUB_ENABLE_CRYPTODISK=y' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
+ echo 'GRUB_PRELOAD_MODULES="lvm cryptodisk mdraid1x"' | $SUDO tee -a $WORK/etc/default/grub > /dev/null
+ hydra_sudo_run chroot $WORK/ update-grub
+ hydra_sudo_run chroot $WORK/ grub-install --recheck --force $device
+ fi
+fi
+
# Utils.
echo "Installing basic utilities..."
$APT_INSTALL screen cron lsb-release openssl -y