From 7cf52228f39c78bda7d2402faf8faf4ee7d4a6e5 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Sat, 6 Jan 2018 20:56:52 +0300 Subject: cmake: reworked debian related package generation rules --- cmake/debian/debian.cmake | 44 +++++++++++++++++++++++++++++--------------- cmake/debian/postinst | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-) (limited to 'cmake') diff --git a/cmake/debian/debian.cmake b/cmake/debian/debian.cmake index e0e3393e..5c994e25 100644 --- a/cmake/debian/debian.cmake +++ b/cmake/debian/debian.cmake @@ -1,8 +1,16 @@ SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) -if (BUILD_DRIVER_ONLY) - if (BUILD_PPTP_DRIVER) +if (NOT DEFINED MODULES_KDIR) + execute_process( + COMMAND uname -r + COMMAND tr -d '\n' + OUTPUT_VARIABLE MODULES_KDIR + ) +endif() + +if (BUILD_PPTP_DRIVER) + if (BUILD_DRIVER_ONLY) SET(CPACK_PACKAGE_VERSION_MAJOR "0") SET(CPACK_PACKAGE_VERSION_MINOR "8") SET(CPACK_PACKAGE_VERSION_PATCH "5") @@ -11,29 +19,35 @@ if (BUILD_DRIVER_ONLY) SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-pptp kernel module") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") - #INSTALL(DIRECTORY lib/modules/${DEBIAN_KDIR}/extra) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/driver/driver/pptp.ko DESTINATION lib/modules/${DEBIAN_KDIR}/extra) - #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "linux-image (= ${LINUX_IMAGE})") - endif (BUILD_PPTP_DRIVER) - - if (BUILD_IPOE_DRIVER) + endif () + #INSTALL(DIRECTORY lib/modules/${DEBIAN_KDIR}/extra) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/driver/driver/pptp.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) + #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "linux-image (= ${LINUX_IMAGE})") +endif (BUILD_PPTP_DRIVER) + +if (BUILD_IPOE_DRIVER) + if (BUILD_DRIVER_ONLY) SET(CPACK_PACKAGING_INSTALL_PREFIX "/") SET(CPACK_PACKAGE_NAME "accel-ppp-ipoe-kmod") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp IPoE kernel module") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe/driver/ipoe.ko DESTINATION lib/modules/${DEBIAN_KDIR}/extra) - endif (BUILD_IPOE_DRIVER) + endif () + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe/driver/ipoe.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) +endif (BUILD_IPOE_DRIVER) - if (BUILD_VLAN_MON_DRIVER) +if (BUILD_VLAN_MON_DRIVER) + if (BUILD_DRIVER_ONLY) SET(CPACK_PACKAGING_INSTALL_PREFIX "/") SET(CPACK_PACKAGE_NAME "accel-ppp-vlan_mon-kmod") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp vlan monitoring kernel module") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/vlan_mon/driver/vlan_mon.ko DESTINATION lib/modules/${DEBIAN_KDIR}/extra) - endif (BUILD_VLAN_MON_DRIVER) -else (BUILD_DRIVER_ONLY) + endif () + 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 (NOT BUILD_DRIVER_ONLY) SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/conffiles") if (CPACK_TYPE STREQUAL Debian6) @@ -45,4 +59,4 @@ else (BUILD_DRIVER_ONLY) INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-init DESTINATION /etc/init.d RENAME accel-ppp) INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-default DESTINATION /etc/default RENAME accel-ppp) endif (CPACK_TYPE STREQUAL Debian6) -endif (BUILD_DRIVER_ONLY) +endif () diff --git a/cmake/debian/postinst b/cmake/debian/postinst index cc381815..0c38b0d7 100755 --- a/cmake/debian/postinst +++ b/cmake/debian/postinst @@ -5,4 +5,6 @@ chmod +x /etc/init.d/accel-ppp mkdir /var/log/accel-ppp > /dev/null 2>&1 mkdir /var/lib/accel-ppp > /dev/null 2>&1 +depmod + exit 0 -- cgit v1.2.3