Skip to content

Commit

Permalink
feat: support start anything server by systemd service
Browse files Browse the repository at this point in the history
On V20 system, the service will keep disable status, and the anything
server will be started by dde-file-manager-daemon. On V25 system, the
service will keep enable status.

Log: support start anything server by systemd service
Bug: https://pms.uniontech.com/bug-view-281871.html
  • Loading branch information
wangrong1069 committed Nov 26, 2024
1 parent 4f316fb commit f08db2a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Files: .gitignore
Copyright: None
License: CC0-1.0

# xml toml json conf yaml policy
Files: *.xml *.toml *.json *conf *.yaml *.policy
# xml toml json conf yaml policy service
Files: *.xml *.toml *.json *conf *.yaml *.policy *.service
Copyright: None
License: CC0-1.0

Expand Down
10 changes: 10 additions & 0 deletions debian/deepin-anything-server.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e

os_maj_ver=`cat /etc/os-version | grep MajorVersion | cut -d '=' -f2`
if [ $os_maj_ver -gt 20 ]; then
#DEBHELPER#
fi

exit 0
1 change: 1 addition & 0 deletions debian/deepin-anything-server.service
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export QT_SELECT=5
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

%:
dh $@ --parallel --with dkms
dh $@ --parallel --with dkms,systemd

override_dh_auto_configure:
dh_auto_configure -Scmake -- \
Expand Down
2 changes: 2 additions & 0 deletions src/server/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ target_link_libraries(${PROJECT_NAME} PUBLIC

# binary
install(TARGETS ${PROJECT_NAME} DESTINATION bin)

install (FILES deepin-anything-server.service DESTINATION lib/systemd/system)
15 changes: 15 additions & 0 deletions src/server/app/deepin-anything-server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Deepin anything server service
After=dbus.service udisks2.service

[Service]
User=root
Group=root
ExecStart=/usr/bin/deepin-anything-server
ExecStartPre=modprobe vfs_monitor
ExecStopPost=rmmod vfs_monitor
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
4 changes: 2 additions & 2 deletions src/server/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ int main(int argc, char *argv[])
app.setOrganizationName("deepin");

if (fireAnything()) {
qCritical() << "fireAnything failed!";
abort();
qWarning() << "fireAnything failed!";
return -1;
}
signal(SIGTERM, handleSIGTERM);

Expand Down

0 comments on commit f08db2a

Please sign in to comment.