Skip to content

Commit

Permalink
plugin: initrd: fix configured modules feature
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Kubik <[email protected]>
  • Loading branch information
kubiko committed Sep 12, 2023
1 parent 54fd931 commit 280878b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions snapcraft_legacy/plugins/v2/_initrd_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _make_initrd_cmd(
"initramfs_conf_dir=${uc_initrd_feature_kernel_modules}/usr/lib/modules-load.d",
"mkdir -p ${initramfs_conf_dir}",
"initramfs_conf=${initramfs_conf_dir}/ubuntu-core-initramfs.conf",
'echo "# configures modules" > ${initramfs_conf}',
'echo "# configured modules" > ${initramfs_conf}',
" ".join(
[
"for",
Expand All @@ -250,7 +250,7 @@ def _make_initrd_cmd(
[
"\tif [",
"-n",
f'"$(modprobe -n -q --show-depends -d {install_dir} -S "${{KERNEL_RELEASE}}" ${{m}})"',
f'"$(modprobe -n -q --show-depends -d {stage_dir} -S "${{KERNEL_RELEASE}}" ${{m}})"',
"]; then",
]
),
Expand Down
6 changes: 3 additions & 3 deletions tests/legacy/unit/plugins/v2/test_initrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,19 +623,19 @@ def _is_sub_array(array, sub_array):
],
),
'echo "Configuring ubuntu-core-initramfs.conf with supported modules"',
'echo "If module is not included in initrd, do not include it"',
'echo "If module does not exist, do not include it"',
"initramfs_conf_dir=${uc_initrd_feature_kernel_modules}/usr/lib/modules-load.d",
"mkdir -p ${initramfs_conf_dir}",
"initramfs_conf=${initramfs_conf_dir}/ubuntu-core-initramfs.conf",
'echo "# configures modules" > ${initramfs_conf}',
'echo "# configured modules" > ${initramfs_conf}',
"for m in $(cat ${initramfs_ko_modules_conf})",
"do",
" ".join(
[
"\tif",
"[ -n",
'"$(modprobe -n -q --show-depends',
"-d ${SNAPCRAFT_PART_INSTALL}",
"-d ${SNAPCRAFT_STAGE}",
'-S "${KERNEL_RELEASE}"',
'${m})" ]; then',
],
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/parts/plugins/test_initrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,19 +803,19 @@ def _is_sub_array(array, sub_array):
],
),
'echo "Configuring ubuntu-core-initramfs.conf with supported modules"',
'echo "If module is not included in initrd, do not include it"',
'echo "If module does not exist, do not include it"',
"initramfs_conf_dir=${uc_initrd_feature_kernel_modules}/usr/lib/modules-load.d",
"mkdir -p ${initramfs_conf_dir}",
"initramfs_conf=${initramfs_conf_dir}/ubuntu-core-initramfs.conf",
'echo "# configures modules" > ${initramfs_conf}',
'echo "# configured modules" > ${initramfs_conf}',
"for m in ${initrd_configured_kernel_modules}",
"do",
" ".join(
[
"\tif",
"[ -n",
'"$(modprobe -n -q --show-depends',
"-d ${CRAFT_PART_INSTALL}",
"-d ${CRAFT_STAGE}",
'-S "${KERNEL_RELEASE}"',
'${m})" ]; then',
],
Expand Down

0 comments on commit 280878b

Please sign in to comment.