diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index 8a7c6e1..a95f909 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -3,6 +3,12 @@ # SPDX-License-Identifier: LGPL-3.0-or-later include(GNUInstallDirs) +macro(install_symlink filepath wantsdir) + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/link/${wantsdir}/) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/${filepath} ${PROJECT_BINARY_DIR}/link/${wantsdir}/${filepath}) + install(FILES ${PROJECT_BINARY_DIR}/link/${wantsdir}/${filepath} DESTINATION lib/systemd/user/${wantsdir}/) +endmacro(install_symlink) + # # systemd service configure_file( systemd/user/org.desktopspec.ApplicationManager1.service.in @@ -14,7 +20,12 @@ set(SYSTEMD_USER_FILE ${CMAKE_CURRENT_BINARY_DIR}/systemd/user/org.desktopspec.ApplicationManager1.service ) -install(FILES ${SYSTEMD_USER_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/) +set(SERVICE_DEST_PATH ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/) + +install(FILES ${SYSTEMD_USER_FILE} DESTINATION ${SERVICE_DEST_PATH}) + +# create a symlink to dde-session +install_symlink(org.desktopspec.ApplicationManager1.service dde-session-initialized.target.wants) # # dbus activate configure_file( diff --git a/misc/systemd/user/org.desktopspec.ApplicationManager1.service.in b/misc/systemd/user/org.desktopspec.ApplicationManager1.service.in index f4ae4e6..3b85497 100644 --- a/misc/systemd/user/org.desktopspec.ApplicationManager1.service.in +++ b/misc/systemd/user/org.desktopspec.ApplicationManager1.service.in @@ -4,12 +4,22 @@ [Unit] Description=Deepin Application Manager +RefuseManualStart=no +RefuseManualStop=no +StartLimitBurst=3 +CollectMode=inactive-or-failed + +Requisite=dde-session-initialized.target +PartOf=dde-session-initialized.target +Before=dde-session-initialized.target [Service] Type=dbus BusName=org.desktopspec.ApplicationManager1 ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/dde-application-manager-reborn -Restart=always Environment=QT_LOGGING_RULES="*.debug=false" -PrivateUsers=false # turn off PrivateUser to prevent AM can't access some directory. eg. "/persistent/linglong" +PrivateUsers=false +Slice=session.slice +Restart=always +RestartSec=500ms