Refactor configuration file installation and template handling

- Update CMakeLists.txt to install the template configuration file as an example, ensuring it is available for reference.
- Modify install-config.cmake to prioritize the installed template file, with fallbacks to source directory templates if the installed one is missing, enhancing the robustness of the configuration setup.
This commit is contained in:
Torsten Schulz (local)
2025-11-18 11:33:33 +01:00
committed by Torsten (PC)
parent e3f46d775a
commit 753c5929e1
2 changed files with 28 additions and 14 deletions

View File

@@ -110,10 +110,10 @@ target_link_libraries(yourpart-daemon PRIVATE
# Installation rules
install(TARGETS yourpart-daemon DESTINATION /usr/local/bin)
# Installiere Template als Referenz ZUERST (wird vom install-Skript benötigt)
install(FILES daemon.conf DESTINATION /etc/yourpart/ RENAME daemon.conf.example)
# Intelligente Konfigurationsdatei-Installation
# Verwendet ein CMake-Skript, das nur fehlende Keys hinzufügt, ohne bestehende zu überschreiben
# Das Skript liest das Template aus dem Source-Verzeichnis und merged es intelligent
# Das Skript liest das Template aus /etc/yourpart/daemon.conf.example oder dem Source-Verzeichnis
install(SCRIPT cmake/install-config.cmake)
# Installiere Template als Referenz (optional, wird nicht überschrieben)
install(FILES daemon.conf DESTINATION /etc/yourpart/ RENAME daemon.conf.example)