Browse Source

Do not overwrite defaults configuration file

This file may contain customized configuration options
which should not be overwritten on install.
tags/1.0
Timo Röhling 12 years ago
parent
commit
0bf71b0f9f
2 changed files with 5 additions and 1 deletions
  1. 0
    1
      CMakeLists.txt
  2. 5
    0
      postinstall.cmake.in

+ 0
- 1
CMakeLists.txt View File

20
 install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
20
 install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
21
 install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
21
 install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
22
 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.init DESTINATION "/etc/init.d" RENAME ${PROJECT_NAME})
22
 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.init DESTINATION "/etc/init.d" RENAME ${PROJECT_NAME})
23
-install(FILES ${PROJECT_NAME}.default DESTINATION "/etc/default" RENAME ${PROJECT_NAME})
24
 install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")
23
 install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")
25
 
24
 

+ 5
- 0
postinstall.cmake.in View File

18
 	COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc6.d/K20@PROJECT_NAME@
18
 	COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc6.d/K20@PROJECT_NAME@
19
 	WORKING_DIRECTORY "$ENV{DESTDIR}/etc"
19
 	WORKING_DIRECTORY "$ENV{DESTDIR}/etc"
20
 )
20
 )
21
+if(NOT EXISTS "$ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
22
+	file(INSTALL "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "/etc/default" RENAME "@PROJECT_NAME@")
23
+else()
24
+	message(STATUS "Keeping old version: $ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
25
+endif()
21
 set(SECRET_FILE "@PROJECT_NAME@.secret")
26
 set(SECRET_FILE "@PROJECT_NAME@.secret")
22
 set(DD "@DD@")
27
 set(DD "@DD@")
23
 set(BASE64 "@BASE64@")
28
 set(BASE64 "@BASE64@")

Loading…
Cancel
Save