Skip to content

Commit

Permalink
src/apps: fix halcs config file to be not relocatable
Browse files Browse the repository at this point in the history
CPack places it under /usr/etc otherwise.
  • Loading branch information
lerwys committed May 5, 2020
1 parent e49e5bc commit 93f821b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/apps/halcs_generic_udev/CMakeConfigureInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if(NOT DEFINED UDEV_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable UDEV_SYSCONFDIR is not defined.")
endif()

if(NOT DEFINED HALCS_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable HALCS_SYSCONFDIR is not defined.")
endif()

if(NOT DEFINED NOPREFIX_HALCS_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable NOPREFIX_HALCS_SYSCONFDIR is not defined.")
endif()
Expand Down Expand Up @@ -60,11 +64,9 @@ set(halcs_generic_udev_SYSTEMD_CONF_INSTALL_DIR "${SYSTEMD_CONF_INSTALL_DIR}")

set(halcs_generic_udev_CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
set(halcs_generic_udev_CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
set(halcs_generic_udev_CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
set(halcs_generic_udev_HALCS_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${NOPREFIX_HALCS_SYSCONFDIR}")
set(halcs_generic_udev_CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
set(halcs_generic_udev_HALCS_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${NOPREFIX_HALCS_DATADIR}")
set(halcs_generic_udev_UDEV_INSTALL_FULL_SYSCONFDIR "${UDEV_SYSCONFDIR}")
set(halcs_generic_udev_HALCS_INSTALL_FULL_SYSCONFDIR "${HALCS_SYSCONFDIR}")

configure_file(${input_file}
${output_file}
Expand Down
10 changes: 9 additions & 1 deletion src/apps/halcs_generic_udev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,22 @@ option(halcs_generic_udev_INSTALL_UDEV_RULES

# udev directories
set(UDEV_RULES_PREFIX "/etc" CACHE STRING
"UDEV rules system prefix (typically /etc ou /usr/lib)")
"UDEV rules system prefix (typically /etc or /usr/lib)")

# relative directory for udev rules
set(NOPREFIX_UDEV_SYSCONFDIR "udev/rules.d")

set(UDEV_SYSCONFDIR "${UDEV_RULES_PREFIX}/${NOPREFIX_UDEV_SYSCONFDIR}")

# halcs config directory
set(HALCS_CFG_PREFIX "/etc" CACHE STRING
"HALCS config files prefix (typically /etc, /usr/etc or /usr/local/etc)")

# relative directory for halcs config files
set(NOPREFIX_HALCS_SYSCONFDIR "halcs")

set(HALCS_SYSCONFDIR ${HALCS_CFG_PREFIX}/${NOPREFIX_HALCS_SYSCONFDIR})

# relative directory for halcs data files
set(NOPREFIX_HALCS_DATADIR "halcs")

Expand Down Expand Up @@ -94,6 +101,7 @@ if(BUILD_halcs_generic_udev)
# to an absolute path.
install(CODE "set(SYSTEMD_SERVICES_INSTALL_DIR ${SYSTEMD_SERVICES_INSTALL_DIR})")
install(CODE "set(SYSTEMD_CONF_INSTALL_DIR ${SYSTEMD_CONF_INSTALL_DIR})")
install(CODE "set(HALCS_SYSCONFDIR ${HALCS_SYSCONFDIR})")
install(CODE "set(UDEV_SYSCONFDIR ${UDEV_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_SYSCONFDIR ${NOPREFIX_HALCS_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_DATADIR ${NOPREFIX_HALCS_DATADIR})")
Expand Down
8 changes: 5 additions & 3 deletions src/apps/halcsd/CMakeConfigureInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if(NOT DEFINED UDEV_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable UDEV_SYSCONFDIR is not defined.")
endif()

if(NOT DEFINED HALCS_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable HALCS_SYSCONFDIR is not defined.")
endif()

if(NOT DEFINED NOPREFIX_HALCS_SYSCONFDIR)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable NOPREFIX_HALCS_SYSCONFDIR is not defined.")
endif()
Expand Down Expand Up @@ -60,10 +64,8 @@ set(halcsd_SYSTEMD_CONF_INSTALL_DIR "${SYSTEMD_CONF_INSTALL_DIR}")

set(halcsd_CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
set(halcsd_CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
set(halcsd_CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
set(halcsd_HALCS_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${NOPREFIX_HALCS_SYSCONFDIR}")
set(halcsd_CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
set(halcsd_HALCS_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${NOPREFIX_HALCS_DATADIR}")
set(halcsd_HALCS_INSTALL_FULL_SYSCONFDIR "${HALCS_SYSCONFDIR}")
set(halcsd_UDEV_INSTALL_FULL_SYSCONFDIR "${UDEV_SYSCONFDIR}")

configure_file(${input_file}
Expand Down
12 changes: 10 additions & 2 deletions src/apps/halcsd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,22 @@ option(halcsd_INSTALL_UDEV_RULES

# udev directories
set(UDEV_RULES_PREFIX "/etc" CACHE STRING
"UDEV rules system prefix (typically /etc ou /usr/lib)")
"UDEV rules system prefix (typically /etc or /usr/lib)")

# relative directory for udev rules
set(NOPREFIX_UDEV_SYSCONFDIR "udev/rules.d")

set(UDEV_SYSCONFDIR "${UDEV_RULES_PREFIX}/${NOPREFIX_UDEV_SYSCONFDIR}")

# halcs config directory
set(HALCS_CFG_PREFIX "/etc" CACHE STRING
"HALCS config files prefix (typically /etc, /usr/etc or /usr/local/etc)")

# relative directory for halcs config files
set(NOPREFIX_HALCS_SYSCONFDIR "halcs")

set(HALCS_SYSCONFDIR ${HALCS_CFG_PREFIX}/${NOPREFIX_HALCS_SYSCONFDIR})

# relative directory for halcs data files
set(NOPREFIX_HALCS_DATADIR "halcs")

Expand Down Expand Up @@ -364,6 +371,7 @@ foreach(bin_target ${apps_halcsd})
install(CODE "set(SYSTEMD_SERVICES_INSTALL_DIR ${SYSTEMD_SERVICES_INSTALL_DIR})")
install(CODE "set(SYSTEMD_CONF_INSTALL_DIR ${SYSTEMD_CONF_INSTALL_DIR})")
install(CODE "set(UDEV_SYSCONFDIR ${UDEV_SYSCONFDIR})")
install(CODE "set(HALCS_SYSCONFDIR ${HALCS_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_SYSCONFDIR ${NOPREFIX_HALCS_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_DATADIR ${NOPREFIX_HALCS_DATADIR})")

Expand Down Expand Up @@ -416,7 +424,7 @@ foreach(bin_target ${apps_halcsd})

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/init/systemd/halcs.cfg
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/${NOPREFIX_HALCS_SYSCONFDIR}
DESTINATION ${HALCS_SYSCONFDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
Expand Down

0 comments on commit 93f821b

Please sign in to comment.