1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 18:57:37 +00:00

data: add systemd unit file for running daemon

This adds a systemd unit file for running the Calls daemon, and adds a
key to the xdg autostart file to instruct gnome-session to ignore
starting when systemd is present. The expectation is that systemd
distros will enable the Calls daemon as a user service and not rely on
xdg autostart / gnome-session for running/managing the service. Systemd
is better at managing services than gnome-session.

Note: it's important to keep the xdg-autostart file around, some distros
(pmOS on openrc, others) don't use systemd and will still need to rely
on the xdg autostart mechanism for starting the Calls daemon.

Co-authored-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Clayton Craft 2024-06-10 14:20:00 -07:00
parent 4bc5f021d0
commit bf6d4c22f4
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
5 changed files with 39 additions and 2 deletions

View file

@ -0,0 +1,11 @@
[Unit]
Description=A phone dialer and call handler (daemon mode)
PartOf=graphical-session.target
[Service]
BusName=org.gnome.Calls
ExecStart=@bindir@/gnome-calls --daemon
Type=dbus
[Install]
WantedBy=graphical-session.target

View file

@ -20,11 +20,11 @@ desktop_daemon_file = i18n.merge_file(
install_dir : join_paths(sysconfdir, 'xdg/autostart')
)
# DBus service
service_data = configuration_data()
service_data.set('bindir', full_bindir)
service_file = 'org.gnome.Calls.service'
# DBus service
service_file = 'org.gnome.Calls.service'
configure_file(
input : service_file + '.in',
output : service_file,
@ -33,6 +33,16 @@ configure_file(
install_dir : full_servicedir,
)
# Systemd user service
systemd_unit = 'calls-daemon.service'
configure_file(
input : systemd_unit + '.in',
output : systemd_unit,
configuration : service_data,
install : true,
install_dir : systemd_user_unit_dir,
)
desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file',

View file

@ -15,3 +15,4 @@ Terminal=false
Categories=Network;GNOME;GTK;Telephony;
X-GNOME-AutoRestart=true
X-GNOME-UsesNotifications=true
X-GNOME-HiddenUnderSystemd=true

View file

@ -59,6 +59,16 @@ libcall_ui_dep = dependency('call-ui',
default_options: ['tests=false', 'examples=false', 'gtk_doc=false'],
)
systemd_user_unit_dir = get_option('systemd_user_unit_dir')
systemd_dep = dependency('systemd', required: false)
if systemd_user_unit_dir == ''
if systemd_dep.found()
systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir')
else
systemd_user_unit_dir = prefix / libdir / 'systemd/user'
endif
endif
config_data = configuration_data()
config_data.set_quoted('APP_ID', calls_id)
config_data.set_quoted('APP_DATA_NAME', calls_name)
@ -145,6 +155,7 @@ summary({
'Build manpages': get_option('manpages'),
'Build tests': get_option('tests'),
'Use gstreamers debug API': get_option('gst_debug'),
'Directory for systemd user units': systemd_user_unit_dir,
})
subdir('po')

View file

@ -13,3 +13,7 @@ option('manpages',
option('gst_debug',
type: 'boolean', value: true,
description: 'Whether to use gstreamers debugging API')
option('systemd_user_unit_dir',
type: 'string', value: '',
description: 'Directory for systemd user units')