Check first for squashfs in `/proc/filesystems`.
This is needed in the --no-kernel use case to avoid the error:
modprobe: FATAL: Module overlay not found in directory /lib/modules/<kver>
Introduce load_fstype function to make it easier to check `/proc/filesystems`
before calling modprobe.
blkid -s TYPE -u noraid -o value "$1"
}
-modprobe squashfs
+load_fstype squashfs
CMDLINE=$(getcmdline)
for arg in $CMDLINE; do
case $arg in
fi
fi
if [ -n "$overlayfs" ]; then
- if ! { strstr "$(< /proc/filesystems)" overlay || modprobe overlay; }; then
+ if ! load_fstype overlay; then
if [ "$overlayfs" = required ]; then
die "OverlayFS is required but not available."
exit 1
done < /lib/dracut/hostonly-files
fi
}
+
+# parameter: kernel_module filesystem_name
+# returns OK if kernel_module is loaded
+# modprobe fails if /lib/modules is not available (--no-kernel use case)
+load_fstype() {
+ strstr "$(cat /proc/filesystems)" "$1" || modprobe "$1"
+}