Add new modprobe element

This element will replace modprobe-blacklist element. It wil
still have the blacklist functionality, but it also adds
the feature of passing a complete file with settings to the
modprobe.d directory. Adding this functionality, that will
allow elements that depends on this module, to just copy the
specified files to the final directory.

Change-Id: I9a44f7d11520b8b1e604956d3c1db2fc7e2bf457
This commit is contained in:
Yolanda Robla 2018-06-21 16:10:53 +02:00
parent e796b3bc18
commit 31383970c7
5 changed files with 68 additions and 0 deletions

View File

@ -10,3 +10,7 @@ to a list of string separated by spaces.
Example: Example:
export DIB_MODPROBE_BLACKLIST="igb" export DIB_MODPROBE_BLACKLIST="igb"
.. note::
This element has been deprecated and replaced by the modprobe element, that
covers 100% the modprobe-blacklist functionality.

View File

@ -0,0 +1,21 @@
========
modprobe
========
Allows to configure specific modprobe options on the image.
It contains the following functionalities:
1. Ability to blacklist specific modules using modprobe.d/blacklist.conf.
In order to use set DIB_MODPROBE_BLACKLIST to the name of your
module. To disable multiple modules you can set DIB_MODPROBE_BLACKLIST
to a list of string separated by spaces.
Example:
export DIB_MODPROBE_BLACKLIST="igb"
2. Ability to copy specific files into /etc/modprobe.d directory, so it
allows to configure settings with freedom. To achieve that, the files
to be copied needs to be placed inside an specific modprobe.d directory
of the element.

View File

@ -0,0 +1,20 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# copy all modprobe.d snippets to /etc/modprobe.d
eval declare -A image_elements=($(get_image_element_array))
for i in "${!image_elements[@]}"; do
element=$i
element_dir=${image_elements[$i]}
if [ -d "${element_dir}/modprobe.d/" ]; then
sudo cp ${element_dir}/modprobe.d/*.conf $TMP_MOUNT_PATH/etc/modprobe.d/
fi
done

View File

@ -0,0 +1,13 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
MODULES_LIST=${DIB_MODPROBE_BLACKLIST:?"Please set DIB_MODPROBE_BLACKLIST."}
for mod_name in $MODULES_LIST; do
echo "blacklist $mod_name" >> /etc/modprobe.d/blacklist.conf
done

View File

@ -0,0 +1,10 @@
---
features:
- Add new modprobe element. This element will replace
modprobe-blacklist element. It wil still have the
blacklist functionality, but it also adds the feature
of passing a complete file with settings to the
modprobe.d directory. Adding this functionality, that
will allow elements that depends on this module, to
just copy the specified files to the final directory.