File: SystemctlEnable.cmake

package info (click to toggle)
kunifiedpush 25.08.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,036 kB
  • sloc: cpp: 4,524; xml: 154; java: 141; makefile: 5; sh: 1
file content (14 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# SPDX-License-Identifier: BSD-2-Clause
# SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>

function(systemctl_enable unit wantedby dir)
    set(wantedby_directory $ENV{DESTDIR}/${dir}/${wantedby}.wants/)
    file(MAKE_DIRECTORY ${wantedby_directory})
    execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../${unit} ${wantedby_directory}/${unit}
        RESULT_VARIABLE enable_result
        ERROR_VARIABLE enable_fail
        COMMAND_ECHO STDOUT)
    if(NOT enable_result EQUAL "0")
        message(FATAL_ERROR "Systemctl failed: ${enable_fail} ${ARGN}")
    endif()
endfunction()