Adjust dracut config

master
Mikhail Novosyolov 4 years ago
parent 0a02c34b05
commit d46af5fbda

@ -47,9 +47,28 @@ sed -e 's/^Session=/Session=lxqt.desktop/' -i /etc/sddm.conf
# packages, and then all needed dracut modules will be already
# installed during inird generation, and there will be no need
# to (re)generate initrds here.
find /boot -name 'vmlinuz-*' | while read -r line ; do
# BUT dracut config by livecd-tools is partly broken
# https://github.com/livecd-tools/livecd-tools/issues/158
# We remove odd parts - modules that do not exist in this kernel.
# Another possible approach is making and using our own config from scratch.
C="${C:-/etc/dracut.conf.d/99-liveos.conf}"
find /boot -name 'vmlinuz-*' | sort -u | while read -r line ; do
kver="$(echo "$line" | sed -e 's,^/boot/vmlinuz-,,g')"
cp "${C}" "${C}.orig"
to_find="$(cat "$C" | grep -E '^(filesystems\+=|add_drivers\+=)' | sed -e 's,",,g' | awk -F '+=' '{print $NF}' | tr ' ' '\n' | grep -v '=' | tr '\n' ' ' | sed -e 's, , ,g')"
not_exist_list=""
for i in ${to_find} ; do
if ! find "/lib/modules/${kver}" -name "${i}.ko*" | grep -q '.' ; then
not_exist_list="${not_exist_list} ${i}"
fi
done
for i in ${not_exist_list} ; do
sed -i -E -e "s,([[:blank:]])*${i}[[:blank:]], ,g" "$C"
done
diff -u "${C}.orig" "${C}" || :
rm -f "${C}.orig"
dracut -f "/boot/initrd-${kver}.img" "${kver}"
done
find /boot -name 'initrd-*' -print
%end