From edc46a055ffed5f2731663fca945a43e151537f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Frohm=C3=BCller?= Date: Mon, 13 Jan 2025 13:30:33 +0100 Subject: [PATCH] Build system fixes --- src/CMakeLists.txt | 6 +++++- src/mininvme/CMakeLists.txt | 8 ++++---- src/mininvme/postinst.in | 8 -------- src/mininvme/prerm.in | 8 -------- src/oscdriver/CMakeLists.txt | 4 ---- src/{oscdriver => }/postinst.in | 7 +++++++ src/{oscdriver => }/prerm.in | 7 +++++++ 7 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 src/mininvme/postinst.in delete mode 100644 src/mininvme/prerm.in rename src/{oscdriver => }/postinst.in (53%) rename src/{oscdriver => }/prerm.in (51%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64b2848..23ec6ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,4 +16,8 @@ pkg_check_modules(LIBCONFIG REQUIRED libconfig) add_subdirectory(opensuperclone) add_subdirectory(oscdriver) add_subdirectory(oscviewer) -add_subdirectory(mininvme) \ No newline at end of file +add_subdirectory(mininvme) + +# Configure the postinst and prerm scripts for the DEB package and put them in the root of the build directory +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postinst.in ${CMAKE_BINARY_DIR}/postinst) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/prerm.in ${CMAKE_BINARY_DIR}/prerm) \ No newline at end of file diff --git a/src/mininvme/CMakeLists.txt b/src/mininvme/CMakeLists.txt index 88a7ed8..8e39a25 100644 --- a/src/mininvme/CMakeLists.txt +++ b/src/mininvme/CMakeLists.txt @@ -1,16 +1,16 @@ set(SOURCES + driver.h ioctl.c + ioctl.h main.c + minipci.h nvme.c + nvme.h ) # Configure the DKMS config file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dkms.conf.in ${CMAKE_CURRENT_BINARY_DIR}/dkms.conf) -# Configure the postinst and prerm scripts for the DEB package and put them in the root of the build directory -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postinst.in ${CMAKE_BINARY_DIR}/postinst) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/prerm.in ${CMAKE_BINARY_DIR}/prerm) - # Install the driver to the source directory install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dkms.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/src/mininvme-${OSC_DRIVER_VERSION}) install(FILES ${SOURCES} DESTINATION ${CMAKE_INSTALL_PREFIX}/src/mininvme-${OSC_DRIVER_VERSION}) diff --git a/src/mininvme/postinst.in b/src/mininvme/postinst.in deleted file mode 100644 index 7ba98f7..0000000 --- a/src/mininvme/postinst.in +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if command -v dkms >/dev/null; then - dkms install mininvme/@MININVME_VERSION@ -else - echo "WARNING: DKMS is not installed, skipping driver installation." - echo "To use native NVMe support you will have to install the driver manually." -fi diff --git a/src/mininvme/prerm.in b/src/mininvme/prerm.in deleted file mode 100644 index 8d50330..0000000 --- a/src/mininvme/prerm.in +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if command -v dkms >/dev/null; then - dkms remove mininvme/@MININVME_VERSION@ --all -else - echo "WARNING: DKMS is not installed, skipping driver removal." - echo "If the driver was installed manually, it will not be removed." -fi diff --git a/src/oscdriver/CMakeLists.txt b/src/oscdriver/CMakeLists.txt index 5c36521..b07c14a 100644 --- a/src/oscdriver/CMakeLists.txt +++ b/src/oscdriver/CMakeLists.txt @@ -8,10 +8,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DI # Configure the DKMS config file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dkms.conf.in ${CMAKE_CURRENT_BINARY_DIR}/dkms.conf) -# Configure the postinst and prerm scripts for the DEB package and put them in the root of the build directory -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postinst.in ${CMAKE_BINARY_DIR}/postinst) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/prerm.in ${CMAKE_BINARY_DIR}/prerm) - # Install the driver to the source directory install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMAKE_INSTALL_PREFIX}/src/oscdriver-${OSC_DRIVER_VERSION}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dkms.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/src/oscdriver-${OSC_DRIVER_VERSION}) diff --git a/src/oscdriver/postinst.in b/src/postinst.in similarity index 53% rename from src/oscdriver/postinst.in rename to src/postinst.in index beefb80..003656d 100644 --- a/src/oscdriver/postinst.in +++ b/src/postinst.in @@ -6,3 +6,10 @@ else echo "WARNING: DKMS is not installed, skipping driver installation." echo "To use the advanced features of OpenSuperClone you will have to install the driver manually." fi + +if command -v dkms >/dev/null; then + dkms install mininvme/@MININVME_VERSION@ +else + echo "WARNING: DKMS is not installed, skipping driver installation." + echo "To use native NVMe support you will have to install the driver manually." +fi diff --git a/src/oscdriver/prerm.in b/src/prerm.in similarity index 51% rename from src/oscdriver/prerm.in rename to src/prerm.in index 93ce1d9..1bb1a5a 100644 --- a/src/oscdriver/prerm.in +++ b/src/prerm.in @@ -6,3 +6,10 @@ else echo "WARNING: DKMS is not installed, skipping driver removal." echo "If the driver was installed manually, it will not be removed." fi + +if command -v dkms >/dev/null; then + dkms remove mininvme/@MININVME_VERSION@ --all +else + echo "WARNING: DKMS is not installed, skipping driver removal." + echo "If the driver was installed manually, it will not be removed." +fi