diff --git a/data/Makefile.am b/data/Makefile.am index e3608a12cc93490fa699f771043190dde44e452c..767413496dbc96a3b416357a4b579be5ca182b68 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -11,12 +11,17 @@ gsettings_SCHEMAS = $(gsettings_schema_files) servicedir = $(datadir)/dbus-1/services service_in_files = org.gnome.OnlineAccounts.service.in +systemduserunitdir = $(prefix)/lib/systemd/user +systemd_service_in_files = goa-daemon.service.in if BUILD_KERBEROS service_in_files += org.gnome.Identity.service.in +systemd_service_in_files += goa-identity-service.service.in endif service_DATA = $(service_in_files:.service.in=.service) +systemduserunit_DATA = $(systemd_service_in_files:.service.in=.service) + %.service: %.service.in Makefile @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ endif @@ -24,11 +29,15 @@ endif EXTRA_DIST = \ $(gsettings_schema_files) \ dbus-interfaces.xml \ + goa-daemon.service.in \ + goa-identity-service.service.in \ org.gnome.Identity.service.in \ org.gnome.OnlineAccounts.service.in \ $(NULL) CLEANFILES = \ + goa-daemon.service \ + goa-identity-service.service \ org.gnome.OnlineAccounts.service \ org.gnome.Identity.service \ $(NULL) diff --git a/data/goa-daemon.service.in b/data/goa-daemon.service.in new file mode 100644 index 0000000000000000000000000000000000000000..764414d3b820671e73f10d2890edaed41feb83c4 --- /dev/null +++ b/data/goa-daemon.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=GNOME Online Accounts service +# Terminate automatically on logout from GUI session +PartOf=graphical-session.target + +[Service] +ExecStart=@libexecdir@/goa-daemon +Type=dbus +BusName=org.gnome.OnlineAccounts +TimeoutStopSec=5 diff --git a/data/goa-identity-service.service.in b/data/goa-identity-service.service.in new file mode 100644 index 0000000000000000000000000000000000000000..9a7b2757e7159676d7be405775486ad60e7ae8bc --- /dev/null +++ b/data/goa-identity-service.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=GNOME identity service for Kerberos +# Terminate automatically on logout from GUI session +PartOf=graphical-session.target + +[Service] +ExecStart=@libexecdir@/goa-identity-service +Type=dbus +BusName=org.gnome.Identity +TimeoutStopSec=5 diff --git a/data/meson.build b/data/meson.build index a62f8e8d2ee872152b87a1871d4e5f789f5a2cc9..42cb8ffab845d5eecb0b89e3deb50e629a70642c 100644 --- a/data/meson.build +++ b/data/meson.build @@ -9,8 +9,10 @@ if enable_goabackend ) services = ['org.gnome.OnlineAccounts.service'] + systemd_services = ['goa-daemon.service'] if enable_kerberos services += 'org.gnome.Identity.service' + systemd_services += ['goa-identity-service.service'] endif service_conf = configuration_data() @@ -25,4 +27,14 @@ if enable_goabackend install_dir: dbus_service_dir ) endforeach + + foreach service: systemd_services + configure_file( + input: service + '.in', + output: service, + configuration: service_conf, + install: true, + install_dir: systemd_userunitdir + ) + endforeach endif diff --git a/data/org.gnome.Identity.service.in b/data/org.gnome.Identity.service.in index bd3b03225ab61485ceb28f060eacedca318eda0a..f70948e8284bdaf1fb4c8797c133df7de48c11e0 100644 --- a/data/org.gnome.Identity.service.in +++ b/data/org.gnome.Identity.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.gnome.Identity Exec=@libexecdir@/goa-identity-service +SystemdService=goa-identity-service.service diff --git a/data/org.gnome.OnlineAccounts.service.in b/data/org.gnome.OnlineAccounts.service.in index ff2b976ab169ca3025a98ec4478df665491132f9..9d8df1115542703bf0511687dd3baf73dd4bd183 100644 --- a/data/org.gnome.OnlineAccounts.service.in +++ b/data/org.gnome.OnlineAccounts.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.gnome.OnlineAccounts Exec=@libexecdir@/goa-daemon +SystemdService=goa-daemon.service diff --git a/meson.build b/meson.build index c3d54c8f2519d683fa514d0add558645b3513e00..f3cffc7274711f22961673fdd358888ac3e31bd2 100644 --- a/meson.build +++ b/meson.build @@ -86,6 +86,20 @@ dbus_dep = dependency('dbus-1') dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir', define_variable: ['datadir', goa_datadir]) +systemd_userunitdir = get_option('systemduserunitdir') + +if systemd_userunitdir == '' + systemd_dep = dependency('systemd', required: false) + + if systemd_dep.found() + systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir') + else + # Fall back to the upstream default. + # Note that this is always 'lib', even if libdir is something else + systemd_userunitdir = join_paths(goa_prefix, 'lib', 'systemd', 'user') + endif +endif + # Libraries # introspection support enable_introspection = get_option('introspection') diff --git a/meson_options.txt b/meson_options.txt index 08c65ecd270af4687b1b4b2cbc2c5f3afc99016e..6cd6219b2f0447a54c7fb817b93513e20c3cac18 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -39,3 +39,4 @@ option('introspection', type: 'boolean', value: true, description: 'Enable GObje option('man', type: 'boolean', value: false, description: 'enable man pages') option('template_file', type: 'string', value: '', description: 'Path to the template file') option('vapi', type: 'boolean', value: true, description: 'build Vala binding') +option('systemduserunitdir', type: 'string', value: '', description: 'Override systemd user unit directory')