systemd: include systemd unit file support
Allow having systemd handling the life cycle of the ModemManager process.
This commit is contained in:
@@ -57,6 +57,7 @@ libwmc/tests/test-wmc
|
||||
data/org.freedesktop.ModemManager1.conf
|
||||
data/org.freedesktop.ModemManager1.service
|
||||
data/org.freedesktop.ModemManager1.policy
|
||||
data/ModemManager.service
|
||||
data/ModemManager.pc
|
||||
data/mm-common.pc
|
||||
data/mm-glib.pc
|
||||
|
||||
@@ -3,6 +3,7 @@ SUBDIRS = . build-aux data include libqcdm libwmc libmm-glib src plugins cli int
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--with-udev-base-dir="$$dc_install_base" \
|
||||
--with-systemdsystemunitdir="$$dc_install_base/$(SYSTEMD_UNIT_DIR)" \
|
||||
--with-tests=yes \
|
||||
--with-docs=yes
|
||||
|
||||
|
||||
@@ -110,6 +110,14 @@ else
|
||||
fi
|
||||
AC_SUBST(UDEV_BASE_DIR)
|
||||
|
||||
# systemd system unit directory
|
||||
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [where systemd service files are]),
|
||||
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
|
||||
if test "x$with_systemdsystemunitdir" != xno; then
|
||||
AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$SYSTEMD_UNIT_DIR" -a "$SYSTEMD_UNIT_DIR" != xno ])
|
||||
|
||||
# PolicyKit
|
||||
AC_ARG_WITH(polkit, AS_HELP_STRING([--with-polkit], [Build with PolicyKit support]))
|
||||
AM_CONDITIONAL(WITH_POLKIT, test "x$with_polkit" = "xyes")
|
||||
@@ -256,6 +264,7 @@ echo "
|
||||
|
||||
D-Bus system directory: ${DBUS_SYS_DIR}
|
||||
udev base directory: ${UDEV_BASE_DIR}
|
||||
systemd unit directory: ${with_systemdsystemunitdir}
|
||||
|
||||
PPP-enabled tests: ${have_pppd_headers}
|
||||
PolicyKit support: ${with_polkit}
|
||||
|
||||
+36
-11
@@ -1,4 +1,11 @@
|
||||
|
||||
edit = @sed \
|
||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|@libexecdir[@]|$(libexecdir)|g'
|
||||
|
||||
|
||||
# DBus Service file
|
||||
dbusservicedir = $(DBUS_SYS_DIR)
|
||||
dbusservice_DATA = org.freedesktop.ModemManager1.conf
|
||||
@@ -14,17 +21,28 @@ org.freedesktop.ModemManager1.conf: $(top_srcdir)/data/$(dbusservice_file_nopol
|
||||
endif
|
||||
|
||||
|
||||
# DBus Activation file
|
||||
edit = @sed \
|
||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|@libexecdir[@]|$(libexecdir)|g'
|
||||
dbusactivationdir = $(datadir)/dbus-1/system-services
|
||||
dbusactivation_in_files = org.freedesktop.ModemManager1.service.in
|
||||
dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service)
|
||||
%service: %service.in
|
||||
# systemd unit file
|
||||
systemdsystemunitdir = $(SYSTEMD_UNIT_DIR)
|
||||
systemdsystemunit_in_files = ModemManager.service.in
|
||||
if HAVE_SYSTEMD
|
||||
systemdsystemunit_DATA = ModemManager.service
|
||||
ModemManager.service: ModemManager.service.in
|
||||
$(edit) $< >$@
|
||||
endif
|
||||
|
||||
|
||||
# DBus Activation file
|
||||
dbusactivationdir = $(datadir)/dbus-1/system-services
|
||||
dbusactivation_DATA = org.freedesktop.ModemManager1.service
|
||||
dbusactivation_in_files_systemd = org.freedesktop.ModemManager1.service.systemd.in
|
||||
dbusactivation_in_files_nosystemd = org.freedesktop.ModemManager1.service.nosystemd.in
|
||||
if HAVE_SYSTEMD
|
||||
org.freedesktop.ModemManager1.service: org.freedesktop.ModemManager1.service.systemd.in
|
||||
$(edit) $< >$@
|
||||
else
|
||||
org.freedesktop.ModemManager1.service: org.freedesktop.ModemManager1.service.nosystemd.in
|
||||
$(edit) $< >$@
|
||||
endif
|
||||
|
||||
|
||||
# Icon
|
||||
@@ -59,8 +77,15 @@ DISTCLEANFILES = \
|
||||
$(dbusactivation_DATA) \
|
||||
$(dbusservice_DATA)
|
||||
|
||||
if HAVE_SYSTEMD
|
||||
DISTCLEANFILES += $(systemdsystemunit_DATA)
|
||||
endif
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(dbusactivation_in_files) \
|
||||
$(systemdsystemunit_in_files) \
|
||||
$(dbusactivation_in_files_systemd) \
|
||||
$(dbusactivation_in_files_nosystemd) \
|
||||
$(dbusservice_file_polkit) \
|
||||
$(dbusservice_file_nopolkit) \
|
||||
$(icon_DATA) \
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Modem Manager
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.freedesktop.ModemManager1
|
||||
ExecStart=@sbindir@/ModemManager
|
||||
StandardError=null
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=dbus-org.freedesktop.ModemManager1.service
|
||||
@@ -0,0 +1,11 @@
|
||||
# This D-Bus service activation file is only for systemd support since
|
||||
# an auto-activated NetworkManager would be quite surprising for those people
|
||||
# who have MM installed but turned off. Thus the Exec path available to
|
||||
# D-Bus is /bin/false, but systemd knows the real Exec path due to the MM
|
||||
# systemd .service file.
|
||||
|
||||
[D-BUS Service]
|
||||
Name=org.freedesktop.ModemManager1
|
||||
Exec=/bin/false
|
||||
User=root
|
||||
SystemdService=dbus-org.freedesktop.ModemManager1.service
|
||||
Reference in New Issue
Block a user