From f6a9226f880dce2b7e45e9e7ed461c4f6bbc912d Mon Sep 17 00:00:00 2001 From: illiliti Date: Thu, 6 Feb 2020 01:02:46 +0300 Subject: [PATCH] implement hostonly LUKS and LVM --- config | 2 +- generate | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/config b/config index 5325613..0afbeb5 100644 --- a/config +++ b/config @@ -12,7 +12,7 @@ debug=1 root="UUID=07729c48-25d8-4096-acaf-ce5322915680" # root type -#root_type="ext4" +root_type="ext4" # root mount options #root_args="" diff --git a/generate b/generate index 20a83fb..3e725c9 100755 --- a/generate +++ b/generate @@ -119,24 +119,43 @@ install_luks() { # TODO keyfile } -# TODO implement hostonly mode # install drivers install_drivers() { modker="${moddir}${kernel}" + # TODO reimplement using functions if [ "$hostonly" = 1 ]; then [ -n "$root_type" ] || panic "hostonly mode required root_type option to be configured" - for modalias in $(find /sys/devices -name modalias -exec sort -u "{}" "+"); do - for driver in $(modprobe -D "$modalias" 2>/dev/null | cut -d " " -f 2); do - install -Dm644 "$driver" "${tmpdir}${driver}" + for driver in $(find /sys/devices -name modalias -exec sort -u "{}" "+"); do + for driver_dep in $(modprobe -D "$driver" 2>/dev/null | cut -d " " -f 2); do + install -Dm644 "$driver_dep" "${tmpdir}${driver_dep}" done done + # TODO separate root type option + # install root fs driver for root_driver in $(modprobe -D "$root_type" 2>/dev/null | cut -d " " -f 2); do install -Dm644 "$root_driver" "${tmpdir}${root_driver}" done - # TODO LUKS - # TODO LVM + # TODO move to install_luks function + # install LUKS drivers + [ "$use_luks" = 1 ] && { + for luks_driver in aes dm-crypt sha256 sha512 wp512 ecb lrw xts twofish serpent; do + for luks_driver_dep in $(modprobe -D "$luks_driver" 2>/dev/null | cut -d " " -f 2); do + install -Dm644 "${luks_driver_dep}" "${tmpdir}${luks_driver_dep}" + done + done + } + + # TODO move to install_lvm function + # install LVM drivers + [ "$use_lvm" = 1 ] && { + for lvm_driver in dm-thin-pool dm-multipath dm-snapshot dm-cache dm-log dm-mirror; do + for lvm_driver_dep in $(modprobe -D "$lvm_driver" 2>/dev/null | cut -d " " -f 2); do + install -Dm644 "$lvm_driver_dep" "${tmpdir}${lvm_driver_dep}" + done + done + } else find \ "${modker}/kernel/drivers/virtio" \