Add a systemd packagekit.service file

We're still bus-activated by default, but now the system bus will
ask systemd to start us.

There are numerous advantages to this model, among them the
ability to use the far more powerful systemd unit config file for
controlling service parameters.

Personally I like just having "systemctl status packagekit" work.

Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
Colin Walters 2013-11-04 04:48:44 -05:00 committed by Richard Hughes
parent c0fa2592d0
commit f40b70e7e7
5 changed files with 23 additions and 0 deletions

View File

@ -278,6 +278,8 @@ AM_CONDITIONAL(PK_BUILD_SYSTEMD, test x$enable_systemd = xyes)
if test x$enable_systemd = xyes; then
PKG_CHECK_MODULES(SYSTEMD, libsystemd-login)
AC_DEFINE(PK_BUILD_SYSTEMD,1,[Build systemd code])
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
dnl ---------------------------------------------------------------------------

View File

@ -341,6 +341,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libdir}/girepository-1.0/PackageKitPlugin-1.0.typelib
%{_datadir}/dbus-1/interfaces/*.xml
/usr/lib/systemd/system/packagekit-offline-update.service
/usr/lib/systemd/system/packagekit.service
%{_libexecdir}/pk-*offline-update
%files docs

View File

@ -30,6 +30,16 @@ servicemain_DATA = $(servicemain_in_files:.service.in=.service)
$(servicemain_DATA): $(servicemain_in_files) Makefile
@sed -e "s|\@servicedir\@|$(libexecdir)|" -e "s|\@PACKAGEKIT_USER\@|$(PACKAGEKIT_USER)|" $< > $@
systemdservice_in_files = packagekit.service.in
if PK_BUILD_SYSTEMD
systemdservicedir = $(systemdsystemunitdir)
systemdservice_DATA = $(systemdservice_in_files:.service.in=.service)
$(systemdservice_DATA): $(systemdservice_in_files) Makefile
@sed -e "s|\@servicedir\@|$(libexecdir)|" -e "s|\@PACKAGEKIT_USER\@|$(PACKAGEKIT_USER)|" $< > $@.tmp && mv $@.tmp $@
endif
databasedir = $(PK_DB_DIR)
database_DATA = \
transactions.db \
@ -46,6 +56,7 @@ EXTRA_DIST = \
$(servicemain_in_files) \
$(servicetest_in_files) \
$(serviceapt_in_files) \
$(systemdservice_in_files) \
$(mime_in_files) \
$(localcache_DATA) \
$(database_DATA) \

View File

@ -2,4 +2,5 @@
Name=org.freedesktop.PackageKit
Exec=@servicedir@/packagekitd
User=@PACKAGEKIT_USER@
SystemdService=packagekit.service

View File

@ -0,0 +1,8 @@
[Unit]
Description=PackageKit Daemon
[Service]
Type=dbus
BusName=org.freedesktop.PackageKit
User=@PACKAGEKIT_USER@
ExecStart=@servicedir@/packagekitd