Skip to content

Commit

Permalink
Add systemd user service
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Pappacoda <[email protected]>
  • Loading branch information
Tachi107 authored and mgallien committed Jun 22, 2022
1 parent af93a98 commit 394c89d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,13 @@ elseif(BUILD_CLIENT)
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(INSTALL_SYSTEMD "Install systemd user service" ON)
if(INSTALL_SYSTEMD)
set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
configure_file(systemd/nextcloud-desktop.service.in ${CMAKE_CURRENT_BINARY_DIR}/nextcloud-desktop.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nextcloud-desktop.service DESTINATION lib/systemd/user)
endif()
endif()

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES INCLUDE_QUIET_PACKAGES)
17 changes: 17 additions & 0 deletions systemd/nextcloud-desktop.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later

[Unit]
Description=Nextcloud desktop user service
Wants=network-online.target

[Service]
ExecStart=@bindir@/nextcloud --background
Restart=on-failure
RestartSec=5s
NoNewPrivileges=true
RestrictRealtime=true

[Install]
WantedBy=default.target

0 comments on commit 394c89d

Please sign in to comment.