Skip to content

Commit

Permalink
chore: dbus activation adapt to AM
Browse files Browse the repository at this point in the history
use systemd service instead of dbus activate
Issue: linuxdeepin/developer-center#9742
  • Loading branch information
fly602 authored and myml committed Jul 26, 2024
1 parent caae9fc commit c009ff2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions calendar-client/assets/dbus/com.deepin.Calendar.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=com.deepin.Calendar
Exec=@EXEC_DDE_CALENDAR@
SystemdService=dde-calendar.service
12 changes: 7 additions & 5 deletions calendar-service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -z noexecstack -pie -fPIC -z lazy")

set(APP_RES_DIR "assets")
set(APP_SERVICE_IN "${APP_RES_DIR}/data/com.deepin.dataserver.Calendar.service.in")
set(APP_SYSTEMD_SERVICE "${APP_RES_DIR}/data/com.dde.calendarserver.calendar.service")
set( SERVER_SERVICE_IN "${APP_RES_DIR}/data/com.deepin.dataserver.Calendar.service.in")
set( APP_SERVICE_IN "${APP_RES_DIR}/data/dde-calendar.service.in")
set( SERVER_SYSTEMD_SERVICE "${APP_RES_DIR}/data/com.dde.calendarserver.calendar.service")
set(APP_SYSTEMD_TIMER "${APP_RES_DIR}/data/com.dde.calendarserver.calendar.timer")
set(AUTOSTART_DESKTOP "${APP_RES_DIR}/dde-calendar-service.desktop")
set(HUANGLIDB "${APP_RES_DIR}/data/huangli.db")
Expand Down Expand Up @@ -72,13 +73,14 @@ target_compile_definitions(${PROJECT_NAME}
#修改dbus服务文件
set (EXEC_DDE_CALENDAR_SERVICE "${SERVICE_INSTALL_DIR}/dde-calendar-service" CACHE STRING "Command to execute dde-calendar-service")

configure_file(${APP_SERVICE_IN} ${CMAKE_CURRENT_BINARY_DIR}/dbus/com.deepin.dataserver.Calendar.service @ONLY)

configure_file(${SERVER_SERVICE_IN} ${CMAKE_CURRENT_BINARY_DIR}/dbus/com.deepin.dataserver.Calendar.service @ONLY)
configure_file(${APP_SERVICE_IN} ${CMAKE_CURRENT_BINARY_DIR}/assets/dde-calendar.service @ONLY)

# Install files
install(TARGETS ${PROJECT_NAME} DESTINATION ${SERVICE_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus/com.deepin.dataserver.Calendar.service DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services/)
install(FILES ${AUTOSTART_DESKTOP} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/xdg/autostart/)
install(FILES ${HUANGLIDB} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-calendar/data/)
install(FILES ${APP_SYSTEMD_SERVICE} DESTINATION lib/systemd/user/)
install(FILES ${SERVER_SYSTEMD_SERVICE} DESTINATION lib/systemd/user/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/assets/dde-calendar.service DESTINATION lib/systemd/user/)
install(FILES ${APP_SYSTEMD_TIMER} DESTINATION lib/systemd/user/)
8 changes: 8 additions & 0 deletions calendar-service/assets/data/dde-calendar.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description = dde-calendar date service

[Service]
ExecStart=@EXEC_DDE_CALENDAR@
Type=dbus
BusName=com.deepin.Calendar
Slice=app.slice

0 comments on commit c009ff2

Please sign in to comment.