implement hostonly LUKS and LVM

This commit is contained in:
illiliti 2020-02-06 01:02:46 +03:00
parent f5891c7811
commit f6a9226f88
2 changed files with 26 additions and 7 deletions

2
config
View File

@ -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=""

View File

@ -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" \