diff --git a/diskimage_builder/elements/modprobe-blacklist/README.rst b/diskimage_builder/elements/modprobe-blacklist/README.rst index b506dd94..6716de72 100644 --- a/diskimage_builder/elements/modprobe-blacklist/README.rst +++ b/diskimage_builder/elements/modprobe-blacklist/README.rst @@ -10,3 +10,7 @@ to a list of string separated by spaces. Example: export DIB_MODPROBE_BLACKLIST="igb" + +.. note:: + This element has been deprecated and replaced by the modprobe element, that + covers 100% the modprobe-blacklist functionality. diff --git a/diskimage_builder/elements/modprobe/README.rst b/diskimage_builder/elements/modprobe/README.rst new file mode 100644 index 00000000..876fdcb5 --- /dev/null +++ b/diskimage_builder/elements/modprobe/README.rst @@ -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. diff --git a/diskimage_builder/elements/modprobe/extra-data.d/50-modprobe-blacklist b/diskimage_builder/elements/modprobe/extra-data.d/50-modprobe-blacklist new file mode 100755 index 00000000..9f8c7119 --- /dev/null +++ b/diskimage_builder/elements/modprobe/extra-data.d/50-modprobe-blacklist @@ -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 diff --git a/diskimage_builder/elements/modprobe/install.d/80-modprobe-blacklist b/diskimage_builder/elements/modprobe/install.d/80-modprobe-blacklist new file mode 100755 index 00000000..6493726f --- /dev/null +++ b/diskimage_builder/elements/modprobe/install.d/80-modprobe-blacklist @@ -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 diff --git a/releasenotes/notes/add-modprobe-element-8e3b0287ebb11920.yaml b/releasenotes/notes/add-modprobe-element-8e3b0287ebb11920.yaml new file mode 100644 index 00000000..63c4d034 --- /dev/null +++ b/releasenotes/notes/add-modprobe-element-8e3b0287ebb11920.yaml @@ -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. +