modules: Add --first-time switch to modprobe commands

On Linux, kernel modules should be loaded once during boot, either in an
initramfs or by this service.

This does not change anything other than printing out messages if a
module is loaded more than once.

X-Gentoo-Bug: 659530
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=659530
This commit is contained in:
William Hubbs 2018-10-23 16:47:37 -05:00
parent c1e582586d
commit d70b1c55b6

View File

@ -56,11 +56,12 @@ load_modules()
ebegin "Loading module $x" ebegin "Loading module $x"
case "$RC_UNAME" in case "$RC_UNAME" in
FreeBSD) kldload "$x"; rc=$? ;; FreeBSD) kldload "$x"; rc=$? ;;
Linux) modprobe --use-blacklist -q "$x"; rc=$? ;; Linux) modprobe --first-time -q --use-blacklist "$x"; rc=$? ;;
*) ;; *) ;;
esac esac
eend $rc "Failed to load $x" eend $rc "Failed to load $x"
done done
return 0
} }
modules_load_d() modules_load_d()
@ -118,7 +119,7 @@ Linux_modules()
[ -n "${args}" ] && break [ -n "${args}" ] && break
done done
[ -z "$args" ] && eval args=\$module_${xx}_args [ -z "$args" ] && eval args=\$module_${xx}_args
eval modprobe --use-blacklist --verbose "$x" "$args" eval modprobe --first-time --use-blacklist --verbose "$x" "$args"
done done
[ -n "$list" ] && eend [ -n "$list" ] && eend
} }