diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2017-01-02 21:05:39 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2017-01-02 21:05:39 -0800 |
commit | 5745d52ff41afb75cca4002db768ed76994cc4ae (patch) | |
tree | a0e22654e18c0233d73605d70973706782c4ab53 | |
parent | doc: cleanup manpage (diff) | |
download | genkernel-5745d52f.tar.gz genkernel-5745d52f.tar.bz2 genkernel-5745d52f.zip |
Allow complete override of MODULES_*
The long-standing but undocumented AMODULES_* options allow adding
ADDITIONAL modules during boot, but there was no way to completely
override the MODULES_* variables.
Add this functionality now, and document it in genkernel.conf.
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=186652
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | genkernel | 20 | ||||
-rw-r--r-- | genkernel.conf | 7 |
2 files changed, 24 insertions, 3 deletions
@@ -105,16 +105,30 @@ echo # Set ${ARCH} get_official_arch -# Read arch-specific config print_info 1 "Using genkernel.conf from ${_GENKERNEL_CONF}" +# Save any customizations of MODULES_* first. +override_module_vars="$(compgen -A variable |grep '^MODULES_')" +for v in $override_module_vars ; do + print_info 1 "Saving $v to override defaults" + newvar=override_$v + eval "${newvar}='${!v}'" +done + +# Read arch-specific config print_info 1 "Sourcing arch-specific config.sh from ${ARCH_CONFIG} .." source ${ARCH_CONFIG} || gen_die "Could not read ${ARCH_CONFIG}" _MODULES_LOAD=${GK_SHARE}/arch/${ARCH}/modules_load print_info 1 "Sourcing arch-specific modules_load from ${_MODULES_LOAD} .." source "${_MODULES_LOAD}" || gen_die "Could not read ${_MODULES_LOAD}" -echo -# Merge modules_load from config +# Now apply customizations of MODULES_* +for v in $override_module_vars; do + newvar=override_$v + print_info 1 "Override $v, default (${!v}), new value (${!newvar})" + eval "${v}='${!newvar}'" +done + +# Merge additional modules_load from config for group_modules in ${!AMODULES_*}; do group="$(echo $group_modules | cut -d_ -f2)" eval cmodules="\$$group_modules" diff --git a/genkernel.conf b/genkernel.conf index 9ff7e4ff..10a03bc4 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -300,6 +300,13 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # Use this with caution. #AMODULES_group="module-to-include another-module" +# Override the default modules in the ramdisk, for a given group, as defined by +# /usr/share/genkernel/default/modules_load and the per-arch modules_load +# files. You PROBABLY want to use AMODULES_* above, and NOT MODULES_* here. +# If you use MODULES_* here, the default and per-arch modules will NOT be used. +#MODULES_group1="some-module" +#MODULES_group2="" # Load no modules for this group + # File to output a .tar.bz2'd modules after the # callbacks have run #MODULESPACKAGE="/path/to/file.bz2" |