I have a CMakeLists.txt that has an additional CPack generator so that if I type "make package" it will generate a Debian package based upon the INSTALL target. This works just fine.
The binary being packaged is a daemon so as part of the package install I want to install the necessary init.d script. Unfortunately, the documentation for CMake/CPack are not wonderful and I am unable to figure out the correct way to do this such that it will install the scripts in the correct location and also not overwrite if they already exist but prompt to do so (just like one would expect if the Debian package had been created using the standard Debian package creation tools.
I could use the standard Debian package tools to do this but using CMake is so much simpler given the simplicity of the package and the fact we already have CMake build files. So my question is, is there a correct way to use CPack to install init.d scripts? This would seem a pretty fundamental thing to want to do so I am surprised I can't find how to do this.