diff --git a/snapcraft_legacy/plugins/v2/_kernel_build.py b/snapcraft_legacy/plugins/v2/_kernel_build.py index e1fd3d80c9..48ec7243b2 100644 --- a/snapcraft_legacy/plugins/v2/_kernel_build.py +++ b/snapcraft_legacy/plugins/v2/_kernel_build.py @@ -1111,7 +1111,7 @@ def _arrange_install_dir_cmd(install_dir: str) -> List[str]: # but snapd expects modules/ and firmware/ mv {install_dir}/lib/modules {install_dir}/ # remove symlinks modules/*/build and modules/*/source - rm {install_dir}/modules/*/build {install_dir}/modules/*/source + rm -f {install_dir}/modules/*/build {install_dir}/modules/*/source # if there is firmware dir, move it to snap root # this could have been from stage packages or from kernel build [ -d {install_dir}/lib/firmware ] && mv {install_dir}/lib/firmware {install_dir} diff --git a/tests/legacy/unit/plugins/v2/test_kernel.py b/tests/legacy/unit/plugins/v2/test_kernel.py index 939316c14b..0b7729ad8c 100644 --- a/tests/legacy/unit/plugins/v2/test_kernel.py +++ b/tests/legacy/unit/plugins/v2/test_kernel.py @@ -1768,7 +1768,7 @@ def _is_sub_array(array, sub_array): # but snapd expects modules/ and firmware/ mv ${SNAPCRAFT_PART_INSTALL}/lib/modules ${SNAPCRAFT_PART_INSTALL}/ # remove symlinks modules/*/build and modules/*/source - rm ${SNAPCRAFT_PART_INSTALL}/modules/*/build ${SNAPCRAFT_PART_INSTALL}/modules/*/source + rm -f ${SNAPCRAFT_PART_INSTALL}/modules/*/build ${SNAPCRAFT_PART_INSTALL}/modules/*/source # if there is firmware dir, move it to snap root # this could have been from stage packages or from kernel build [ -d ${SNAPCRAFT_PART_INSTALL}/lib/firmware ] && mv ${SNAPCRAFT_PART_INSTALL}/lib/firmware ${SNAPCRAFT_PART_INSTALL} diff --git a/tests/unit/parts/plugins/test_kernel.py b/tests/unit/parts/plugins/test_kernel.py index 0bc4a68166..09db04137b 100644 --- a/tests/unit/parts/plugins/test_kernel.py +++ b/tests/unit/parts/plugins/test_kernel.py @@ -1919,7 +1919,7 @@ def _is_sub_array(array, sub_array): # but snapd expects modules/ and firmware/ mv ${CRAFT_PART_INSTALL}/lib/modules ${CRAFT_PART_INSTALL}/ # remove symlinks modules/*/build and modules/*/source - rm ${CRAFT_PART_INSTALL}/modules/*/build ${CRAFT_PART_INSTALL}/modules/*/source + rm -f ${CRAFT_PART_INSTALL}/modules/*/build ${CRAFT_PART_INSTALL}/modules/*/source # if there is firmware dir, move it to snap root # this could have been from stage packages or from kernel build [ -d ${CRAFT_PART_INSTALL}/lib/firmware ] && mv ${CRAFT_PART_INSTALL}/lib/firmware ${CRAFT_PART_INSTALL}