diff options
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | cmake/centos/centos.cmake | 18 | ||||
| -rw-r--r-- | cmake/debian/debian.cmake | 11 | ||||
| -rw-r--r-- | tests/README.md | 3 | ||||
| -rw-r--r-- | tests/kernel-module-install/test.sh | 31 |
5 files changed, 65 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e13264..17e753d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,8 @@ VLAN monitoring packet-handler registration on Linux 6.6 and newer. - Build / install: install kernel modules from their actual build directories, honor `DESTDIR`, and propagate installation failures. +- Packaging: include the optional PPPoSEQ kernel module in Debian and RPM + installation rules, including standalone driver packages. ### Docs - Refreshed the README and synchronized the sample configuration and man diff --git a/cmake/centos/centos.cmake b/cmake/centos/centos.cmake index a0dcd279..00cd0c6a 100644 --- a/cmake/centos/centos.cmake +++ b/cmake/centos/centos.cmake @@ -1,6 +1,14 @@ SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) +if (NOT DEFINED CENTOS_KDIR) + execute_process( + COMMAND uname -r + OUTPUT_VARIABLE CENTOS_KDIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif () + if (BUILD_DRIVER_ONLY) if (BUILD_IPOE_DRIVER) SET(CPACK_PACKAGING_INSTALL_PREFIX "/") @@ -22,3 +30,13 @@ else (BUILD_DRIVER_ONLY) INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/accel-pppd/accel-ppp.conf DESTINATION /etc RENAME accel-ppp.conf.dist) endif (BUILD_DRIVER_ONLY) +if (BUILD_PPPOSEQ_DRIVER) + if (BUILD_DRIVER_ONLY) + SET(CPACK_PACKAGING_INSTALL_PREFIX "/") + SET(CPACK_PACKAGE_NAME "accel-ppp-ppposeq-kmod") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp PPPoSEQ kernel module") + SET(CPACK_RPM_PACKAGE_REQUIRES "") + endif () + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ppposeq/driver/ppposeq.ko DESTINATION /lib/modules/${CENTOS_KDIR}/extra) +endif (BUILD_PPPOSEQ_DRIVER) + diff --git a/cmake/debian/debian.cmake b/cmake/debian/debian.cmake index 89ab9993..1b6ab8ce 100644 --- a/cmake/debian/debian.cmake +++ b/cmake/debian/debian.cmake @@ -31,6 +31,17 @@ if (BUILD_VLAN_MON_DRIVER) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/vlan_mon/driver/vlan_mon.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) endif (BUILD_VLAN_MON_DRIVER) +if (BUILD_PPPOSEQ_DRIVER) + if (BUILD_DRIVER_ONLY) + SET(CPACK_PACKAGING_INSTALL_PREFIX "/") + SET(CPACK_PACKAGE_NAME "accel-ppp-ppposeq-kmod") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp PPPoSEQ kernel module") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") + SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") + endif () + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ppposeq/driver/ppposeq.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) +endif (BUILD_PPPOSEQ_DRIVER) + if (NOT BUILD_DRIVER_ONLY) SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/conffiles") diff --git a/tests/README.md b/tests/README.md index d89958e1..44bae6a4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -38,6 +38,9 @@ The kernel module installation regression test is rootless and does not need kernel headers. It uses a fake kernel build tree to verify that `ipoe`, `vlan_mon`, and `ppposeq` are installed from their actual build directories, honor `DESTDIR`, and make installation fail when `modules_install` fails. +It also verifies that Debian and CentOS packaging configurations include +`ppposeq.ko` with the standalone driver package name, and omit it when the +build flag is disabled. Run it through CTest after configuring the project: diff --git a/tests/kernel-module-install/test.sh b/tests/kernel-module-install/test.sh index 1fbfd623..2f3ec579 100644 --- a/tests/kernel-module-install/test.sh +++ b/tests/kernel-module-install/test.sh @@ -36,3 +36,34 @@ if FAIL_MODULES_INSTALL=1 DESTDIR="${work_dir}/failed-stage" \ fi grep -q 'Failed to install kernel module' "${work_dir}/failed-install.log" + +# Packaging configurations bypass modules_install and must install the .ko +# explicitly, including when PPPoSEQ is built as a standalone driver package. +for package_type in Debian12 Centos9; do + package_build="${work_dir}/package-${package_type}" + package_stage="${work_dir}/stage-${package_type}" + "${cmake_command}" \ + -S "${source_dir}" \ + -B "${package_build}" \ + -DBUILD_TESTING=OFF \ + -DBUILD_DRIVER_ONLY=TRUE \ + -DBUILD_PPPOSEQ_DRIVER=TRUE \ + -DIGNORE_GIT=TRUE \ + -DCPACK_TYPE="${package_type}" \ + -DMODULES_KDIR=test-kernel \ + -DCENTOS_KDIR=test-kernel \ + -DKDIR="${script_dir}" + "${cmake_command}" --build "${package_build}" + DESTDIR="${package_stage}" \ + "${cmake_command}" --install "${package_build}" + test -f "${package_stage}/lib/modules/test-kernel/extra/ppposeq.ko" + grep -q 'set(CPACK_PACKAGE_NAME "accel-ppp-ppposeq-kmod")' \ + "${package_build}/CPackConfig.cmake" + + # A stale build artifact must not be installed after the flag is disabled. + "${cmake_command}" -S "${source_dir}" -B "${package_build}" \ + -DBUILD_PPPOSEQ_DRIVER=FALSE + DESTDIR="${package_stage}-disabled" \ + "${cmake_command}" --install "${package_build}" + test ! -e "${package_stage}-disabled/lib/modules/test-kernel/extra/ppposeq.ko" +done |
