diff --git a/tools/init.d/CMakeLists.init b/tools/init.d/CMakeLists.init index 342176be3c2..c551eb6f548 100644 --- a/tools/init.d/CMakeLists.init +++ b/tools/init.d/CMakeLists.init @@ -18,25 +18,27 @@ macro (CREATE_INIT_SCRIPT daemonname) -set(package_name ${daemonname}-metrika-yandex) +set(filename ${daemonname}-metrika-yandex) -# опционально принимаем package_name вторым аргументом +# опционально принимаем filename вторым аргументом set(extra_args ${ARGN}) list(LENGTH extra_args num_extra_args) if (${num_extra_args} GREATER 0) list(GET extra_args 0 optional_arg) - set(package_name ${optional_arg}) + set(filename ${optional_arg}) endif() +set(tmp_file_name ${filename}.init) add_custom_target(${daemonname}-init.target ALL - COMMAND sed -e 's,[@]DAEMON[@],${daemonname},g' < ${PROJECT_SOURCE_DIR}/tools/init.d/template > ${CMAKE_CURRENT_BINARY_DIR}/${package_name} - COMMAND sed -i 's,[@]CRONFILE[@],${package_name},g' ${CMAKE_CURRENT_BINARY_DIR}/${package_name} - COMMAND chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/${package_name} + COMMAND sed -e 's,[@]DAEMON[@],${daemonname},g' < ${PROJECT_SOURCE_DIR}/tools/init.d/template > ${CMAKE_CURRENT_BINARY_DIR}/${tmp_file_name} + COMMAND sed -i 's,[@]CRONFILE[@],${filename},g' ${CMAKE_CURRENT_BINARY_DIR}/${tmp_file_name} + COMMAND chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/${tmp_file_name} COMMENT "Building ${daemonname}" ) INSTALL( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${package_name} + FILES ${CMAKE_CURRENT_BINARY_DIR}/${tmp_file_name} DESTINATION /etc/init.d + RENAME ${filename} PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ ) endmacro (CREATE_INIT_SCRIPT)