-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add DBus interface to enable service
非开发者模式下设置systemd服务失败(cli同样) 调整非开发者模式下的服务设置方式,改由后端 服务执行 Log: 修复设置服务启动方式失败问题 Bug: https://pms.uniontech.com/bug-view-241793.html Change-Id: I577ac58d6061c8445e46c5e9d131483e6fe53715
- Loading branch information
Showing
88 changed files
with
1,648 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
|
||
set(BIN_NAME deepin-system-monitor-system-server) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") | ||
|
||
# 设置包含头文件的时候不用包含路径 begin **************************************************************************************** | ||
MACRO(SUBDIRLIST result curdir) | ||
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) | ||
SET(dirlist "") | ||
FOREACH(child ${children}) | ||
IF(IS_DIRECTORY ${curdir}/${child}) | ||
LIST(APPEND dirlist ${child}) | ||
ENDIF() | ||
ENDFOREACH() | ||
SET(${result} ${dirlist}) | ||
ENDMACRO() | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
SUBDIRLIST(dirs ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
foreach(dir ${dirs}) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${dir}) | ||
endforeach() | ||
# 设置包含头文件的时候不用包含路径 end **************************************************************************************** | ||
|
||
file(GLOB_RECURSE SRC_CPP ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp) | ||
file(GLOB_RECURSE SRC_H ${CMAKE_CURRENT_LIST_DIR}/src/*.h) | ||
|
||
find_package(Qt5 COMPONENTS Core DBus REQUIRED) | ||
find_package(PolkitQt5-1 REQUIRED) | ||
|
||
add_library(${BIN_NAME} MODULE | ||
${SRC_CPP} | ||
${SRC_H} | ||
) | ||
|
||
target_include_directories(${BIN_NAME} PUBLIC | ||
Qt5::Core | ||
Qt5::DBus | ||
PolkitQt5-1::Agent | ||
) | ||
|
||
target_link_libraries(${BIN_NAME} PRIVATE | ||
Qt5::Core | ||
Qt5::DBus | ||
PolkitQt5-1::Agent | ||
) | ||
|
||
# Use deepin-service-manager mange DBus servicde | ||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/) | ||
install(FILES ./misc/${BIN_NAME}.json DESTINATION share/deepin-service-manager/system/) | ||
# DBus service and conf | ||
install(FILES ./misc/org.deepin.SystemMonitorSystemServer.service DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system-services) | ||
install(FILES ./misc/org.deepin.SystemMonitorSystemServer.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system.d) | ||
# Polkit; Update translation | ||
set(POLICY_FILE org.deepin.deepin-system-monitor-system-server.policy) | ||
find_program(POLICY_TS_CONV deepin-policy-ts-convert REQUIRED) | ||
add_custom_target(APP_POLICY_FILE_TEST | ||
ALL | ||
COMMAND ${POLICY_TS_CONV} ts2policy ${CMAKE_CURRENT_SOURCE_DIR}/misc/${POLICY_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/translations/policy/ ${POLICY_FILE}.tmp | ||
COMMAND mv ${POLICY_FILE}.tmp ${CMAKE_CURRENT_SOURCE_DIR}/misc/${POLICY_FILE} | ||
) | ||
install(FILES ./misc/${POLICY_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/polkit-1/actions) |
12 changes: 12 additions & 0 deletions
12
deepin-system-monitor-system-server/misc/deepin-system-monitor-system-server.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "org.deepin.SystemMonitorSystemServer", | ||
"libPath": "libdeepin-system-monitor-system-server.so", | ||
"group": "app", | ||
"policyStartType": "OnDemand", | ||
"pluginType": "qt", | ||
"policy": [ | ||
{ | ||
"path": "/org/deepin/SystemMonitorSystemServer" | ||
} | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
deepin-system-monitor-system-server/misc/org.deepin.SystemMonitorSystemServer.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- -*- XML -*- --> | ||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
<!-- Only root can own the service --> | ||
<policy user="root"> | ||
<allow own="org.deepin.SystemMonitorSystemServer" /> | ||
</policy> | ||
<!-- Allow anyone to invoke methods on the interfaces --> | ||
<policy context="default"> | ||
<allow own="org.deepin.SystemMonitorSystemServer" /> | ||
<allow send_destination="org.deepin.SystemMonitorSystemServer" /> | ||
<allow send_destination="org.deepin.SystemMonitorSystemServer" send_interface="org.deepin.SystemMonitorSystemServer" /> | ||
<allow send_destination="org.deepin.SystemMonitorSystemServer" send_interface="org.freedesktop.DBus.Properties" /> | ||
<allow send_destination="org.deepin.SystemMonitorSystemServer" send_interface="org.freedesktop.DBus.Introspectable" /> | ||
</policy> | ||
</busconfig> |
5 changes: 5 additions & 0 deletions
5
deepin-system-monitor-system-server/misc/org.deepin.SystemMonitorSystemServer.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[D-BUS Service] | ||
Name=org.deepin.SystemMonitorSystemServer | ||
Exec=/usr/bin/deepin-service-manager -n org.deepin.SystemMonitorSystemServer | ||
User=root | ||
SystemdService=deepin-service-plugin@org.deepin.SystemMonitorSystemServer.service |
Oops, something went wrong.