function(install_ls2_roles path role)
    file(GLOB files "${path}/*.json.${role}.in")
    foreach(file ${files})
        get_filename_component(filename ${file} NAME)
        string(REGEX REPLACE ".${role}.in" "" dst_filename ${filename})
        configure_file(${file} "files/sysbus/${role}/${dst_filename}")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/files/sysbus/${role}/${dst_filename}" DESTINATION "usr/share/ls2/roles/${role}")
    endforeach()
endfunction()

function(install_ls2_service path role)
    file(GLOB files "${path}/*.service.${role}.in")
    foreach(file ${files})
        get_filename_component(filename ${file} NAME)
        string(REGEX REPLACE ".${role}.in" "" dst_filename ${filename})
        configure_file(${file} "files/sysbus/${role}/${dst_filename}")
        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/files/sysbus/${role}/${dst_filename}" DESTINATION "usr/share/dbus-1/system-services")
    endforeach()
endfunction()

