Skip to content

Commit

Permalink
refactor: use systemd to start AppManager
Browse files Browse the repository at this point in the history
We can use systemd to start AppManager.

This commit remove the old configure files of autostart AppManager.
  • Loading branch information
Chen Linxuan authored and l631197874 committed Nov 2, 2023
1 parent 9129260 commit 0f66e8a
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 5 deletions.
9 changes: 5 additions & 4 deletions debian/linglong-bin.install
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ usr/bin/ll-service
usr/bin/ll-cli
usr/bin/ll-package-manager
usr/bin/ll-system-helper
usr/share/applications/org.deepin.linglong.service.desktop
etc/xdg/autostart/org.deepin.linglong.service.desktop
etc/profile.d/linglong.sh
etc/X11/Xsession.d/21linglong
usr/share/linglong/config.json
Expand All @@ -15,8 +13,11 @@ usr/share/dbus-1/system.d/org.deepin.linglong.PackageManager.conf
usr/share/dbus-1/system-services/org.deepin.linglong.PackageManager.service
usr/share/dbus-1/system.d/org.deepin.linglong.SystemHelper.conf
usr/share/dbus-1/system-services/org.deepin.linglong.SystemHelper.service
lib/systemd/system/org.deepin.linglong.PackageManager.service
lib/systemd/system/org.deepin.linglong.SystemHelper.service
usr/share/dbus-1/services/org.deepin.linglong.AppManager.service
usr/lib/systemd/system/org.deepin.linglong.PackageManager.service
usr/lib/systemd/user/org.deepin.linglong.AppManager.service
usr/lib/systemd/system/org.deepin.linglong.SystemHelper.service
usr/lib/sysusers.d/linglong.conf
usr/share/mime/packages/deepin-linglong.xml

usr/libexec/linglong/upgrade-all
Expand Down
84 changes: 83 additions & 1 deletion misc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,45 @@ configure_file(
systemd/user/linglong-upgrade.service
@ONLY
)
configure_file(
dbus/org.deepin.linglong.AppManager.service.in
dbus/org.deepin.linglong.AppManager.service
)

set(SYSTEMD_USER_FILE
${CMAKE_CURRENT_BINARY_DIR}/systemd/user/linglong-upgrade.service
systemd/user/linglong-upgrade.timer
)

install(FILES ${SYSTEMD_USER_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/)

set(DBUS_SESSION_SERVICE_FILE
${CMAKE_CURRENT_BINARY_DIR}/dbus/org.deepin.linglong.AppManager.service
)

# dbus will not load files in /usr/local/share/dbus-1/system.d. So we have to
# make sure the .conf file(s) installed to /usr/share
install(FILES ${DBUS_CONFIG_FILE} DESTINATION /usr/share/dbus-1/system.d)

install(FILES ${DBUS_SYSTEM_SERVICE_FILE}
DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system-services
)

install(FILES ${DBUS_SESSION_SERVICE_FILE}
DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services
)

# linglong

set(LINGLONG_CONFIG_FILES linglong/builder.yaml linglong/config.json)

install(FILES linglong/builder.yaml
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/linglong
)

install(FILES linglong/config.json
DESTINATION ${CMAKE_INSTALL_DATADIR}/linglong
)

configure_file(
Expand All @@ -28,3 +59,54 @@ set(LINGLONG_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/scripts/upgrade-all)
install(PROGRAMS ${LINGLONG_SCRIPTS}
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/linglong/
)

# systemd

configure_file(
systemd/service/org.deepin.linglong.AppManager.service.in
systemd/service/org.deepin.linglong.AppManager.service
)

set(SYSTEMD_SYSTEM_SERVICE_FILE
# cmake-format: sortable
${CMAKE_CURRENT_BINARY_DIR}/systemd/service/org.deepin.linglong.PackageManager.service
${CMAKE_CURRENT_BINARY_DIR}/systemd/service/org.deepin.linglong.SystemHelper.service
)

install(FILES ${SYSTEMD_SYSTEM_SERVICE_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system/
)

set(SYSTEMD_USER_SERVICE_FILE
${CMAKE_CURRENT_BINARY_DIR}/systemd/service/org.deepin.linglong.AppManager.service
)

install(FILES ${SYSTEMD_USER_SERVICE_FILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user/
)

install(
PROGRAMS systemd/user-environment-generators/61-linglong
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user-environment-generators/
)

install(
PROGRAMS systemd/system-environment-generators/61-linglong
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system-environment-generators/
)

# sysuser

pkg_get_variable(
SYSUSERSDIR
systemd
sysusersdir
)

install(FILES sysuser/linglong.conf DESTINATION ${SYSUSERSDIR})

# xdg

install(FILES xdg/mime/deepin-linglong.xml
DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages
)
4 changes: 4 additions & 0 deletions misc/dbus/org.deepin.linglong.AppManager.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.deepin.linglong.AppManager
Exec=@CMAKE_INSTALL_FULL_BINDIR@/ll-service
SystemdService=org.deepin.linglong.AppManager.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Linglong AppManager service

[Service]
Type=dbus
BusName=org.deepin.linglong.AppManager
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/ll-service
Restart=on-failure
RestartSec=10

0 comments on commit 0f66e8a

Please sign in to comment.