core: add systemd unit support
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -108,4 +108,7 @@ m4/lt*.m4
|
|||||||
policy/org.freedesktop.network-manager-settings.system.policy
|
policy/org.freedesktop.network-manager-settings.system.policy
|
||||||
policy/org.freedesktop.NetworkManager.policy
|
policy/org.freedesktop.NetworkManager.policy
|
||||||
|
|
||||||
|
data/NetworkManager.service
|
||||||
|
data/org.freedesktop.NetworkManager.service
|
||||||
|
|
||||||
cli/src/nmcli
|
cli/src/nmcli
|
||||||
|
@@ -10,6 +10,7 @@ SUBDIRS = \
|
|||||||
cli \
|
cli \
|
||||||
tools \
|
tools \
|
||||||
policy \
|
policy \
|
||||||
|
data \
|
||||||
initscript \
|
initscript \
|
||||||
test \
|
test \
|
||||||
po \
|
po \
|
||||||
@@ -24,7 +25,11 @@ EXTRA_DIST = \
|
|||||||
intltool-merge.in \
|
intltool-merge.in \
|
||||||
intltool-update.in
|
intltool-update.in
|
||||||
|
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --with-tests=yes --with-docs=yes --with-udev-dir=$$dc_install_base/lib/udev
|
DISTCHECK_CONFIGURE_FLAGS = \
|
||||||
|
--with-tests=yes \
|
||||||
|
--with-docs=yes \
|
||||||
|
--with-udev-dir=$$dc_install_base/lib/udev \
|
||||||
|
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
||||||
|
|
||||||
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
|
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
|
||||||
|
|
||||||
|
15
configure.ac
15
configure.ac
@@ -237,6 +237,14 @@ else
|
|||||||
fi
|
fi
|
||||||
AC_SUBST(UDEV_BASE_DIR)
|
AC_SUBST(UDEV_BASE_DIR)
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
AC_ARG_WITH([systemdsystemunitdir],
|
||||||
|
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
|
||||||
|
[],
|
||||||
|
[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
|
||||||
|
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
|
||||||
|
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBNL, libnl-1 >= 1.0-pre8)
|
PKG_CHECK_MODULES(LIBNL, libnl-1 >= 1.0-pre8)
|
||||||
AC_SUBST(LIBNL_CFLAGS)
|
AC_SUBST(LIBNL_CFLAGS)
|
||||||
AC_SUBST(LIBNL_LIBS)
|
AC_SUBST(LIBNL_LIBS)
|
||||||
@@ -528,6 +536,7 @@ man/nm-online.1
|
|||||||
man/nmcli.1
|
man/nmcli.1
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
policy/Makefile
|
policy/Makefile
|
||||||
|
data/Makefile
|
||||||
docs/Makefile
|
docs/Makefile
|
||||||
docs/libnm-glib/Makefile
|
docs/libnm-glib/Makefile
|
||||||
docs/libnm-util/Makefile
|
docs/libnm-util/Makefile
|
||||||
@@ -555,6 +564,12 @@ else
|
|||||||
echo dhcpcd support: no
|
echo dhcpcd support: no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n "${with_systemdsystemunitdir}"; then
|
||||||
|
echo systemd support: ${with_systemdsystemunitdir}
|
||||||
|
else
|
||||||
|
echo systemd support: no
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo Building documentation: ${with_docs}
|
echo Building documentation: ${with_docs}
|
||||||
echo Building tests: ${with_tests}
|
echo Building tests: ${with_tests}
|
||||||
|
26
data/Makefile.am
Normal file
26
data/Makefile.am
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
if HAVE_SYSTEMD
|
||||||
|
systemdsystemunit_DATA = NetworkManager.service
|
||||||
|
|
||||||
|
NetworkManager.service: NetworkManager.service.in
|
||||||
|
$(edit) $< >$@
|
||||||
|
|
||||||
|
servicedir = $(datadir)/dbus-1/system-services
|
||||||
|
service_in_files = org.freedesktop.NetworkManager.service.in
|
||||||
|
service_DATA = $(service_in_files:.service.in=.service)
|
||||||
|
|
||||||
|
$(service_DATA): $(service_in_files) Makefile
|
||||||
|
$(edit) $< >$@
|
||||||
|
endif
|
||||||
|
|
||||||
|
edit = sed \
|
||||||
|
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||||
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
-e 's|@localstatedir[@]|$(localstatedir)|g'
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
NetworkManager.service.in \
|
||||||
|
org.freedesktop.NetworkManager.service.in
|
||||||
|
|
||||||
|
CLEANFILES = NetworkManager.service org.freedesktop.NetworkManager.service
|
||||||
|
|
12
data/NetworkManager.service.in
Normal file
12
data/NetworkManager.service.in
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Network Manager
|
||||||
|
After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=dbus
|
||||||
|
BusName=org.freedesktop.NetworkManager
|
||||||
|
ExecStart=@sbindir@/NetworkManager --no-daemon
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=network.target multi-user.target
|
||||||
|
Alias=NetworkManager-by-dbus
|
11
data/org.freedesktop.NetworkManager.service.in
Normal file
11
data/org.freedesktop.NetworkManager.service.in
Normal file
@@ -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 NM 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 NM
|
||||||
|
# systemd .service file.
|
||||||
|
|
||||||
|
[D-BUS Service]
|
||||||
|
Name=org.freedesktop.NetworkManager
|
||||||
|
Exec=/bin/false
|
||||||
|
User=root
|
||||||
|
SystemdService=NetworkManager-by-dbus.service
|
Reference in New Issue
Block a user