summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-01-07 07:42:11 -0800
committerPatrick Venture <venture@google.com>2019-01-28 08:19:36 -0800
commit042e47233150dbd8fe0a1bed47b47340ef4860b5 (patch)
treed1c58e926d7e36f3d7ad496cb060c4d4762762f0
parentfbafa25b0cbc9e20b9da0cc0fd007370b9f8fadd (diff)
downloadphosphor-networkd-042e47233150dbd8fe0a1bed47b47340ef4860b5.tar.gz
phosphor-networkd-042e47233150dbd8fe0a1bed47b47340ef4860b5.zip
move service file, dbus conf into repo
Move the service file for phosphor-networkd from the bitbake recipe to the source repository. Move the dbus configuration file for phosphor-network from a generated file to the source repository. Tested: Verified dbus conf and service file were installed where expected. Change-Id: Idd1a1872aeb020f6b0e2eb9dba7c2e96198be2af Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac33
-rw-r--r--xyz.openbmc_project.Network.conf.in8
-rw-r--r--xyz.openbmc_project.Network.service.in16
4 files changed, 65 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 43f4643..8e5c191 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,14 @@ nobase_nodist_include_HEADERS = \
xyz/openbmc_project/Network/VLAN/Create/server.hpp \
xyz/openbmc_project/Network/IP/Create/server.hpp
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ xyz.openbmc_project.Network.service
+
+dbuspolicy_DATA = \
+ xyz.openbmc_project.Network.conf
+endif
+
sbin_PROGRAMS = phosphor-network-manager ncsi-netlink
noinst_HEADERS = \
diff --git a/configure.ac b/configure.ac
index 1bc24c7..14ed382 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,34 @@ AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-unused-result], [CFLAGS])
# Checks for library functions.
LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
+ [],
+ [with_systemdsystemunitdir=auto]
+)
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
+ [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+ AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+ [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+ [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]
+ )
+ with_systemdsystemunitdir=no],
+ [with_systemdsystemunitdir="$def_systemdsystemunitdir"]
+ )]
+)
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+ [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
+)
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
+AC_ARG_WITH([dbuspolicydir],
+ AS_HELP_STRING([--with-dbuspolicydir=DIR], [Directory for D-Bus system policy files])
+)
+AS_IF([test "x$with_dbuspolicydir" = "x"],
+ [with_dbuspolicydir="${sysconfdir}/dbus-1/system.d"]
+)
+AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
# Check/set gtest specific functions.
AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
@@ -106,10 +134,15 @@ AC_ARG_VAR(NETWORK_CONF_DIR, [Network configuration directory])
AS_IF([test "x$NETWORK_CONF_DIR" == "x"], [NETWORK_CONF_DIR="/etc/systemd/network"])
AC_DEFINE_UNQUOTED([NETWORK_CONF_DIR], ["$NETWORK_CONF_DIR"], [Network configuration directory])
+AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service")
+AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"])
+
AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1", [systemd busname.])
AC_DEFINE(SYSTEMD_PATH, "/org/freedesktop/systemd1", [systemd path.])
AC_DEFINE(SYSTEMD_INTERFACE, "org.freedesktop.systemd1.Manager", [systemd interface.])
# Create configured output.
AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([xyz.openbmc_project.Network.service])
+AC_CONFIG_FILES([xyz.openbmc_project.Network.conf])
AC_OUTPUT
diff --git a/xyz.openbmc_project.Network.conf.in b/xyz.openbmc_project.Network.conf.in
new file mode 100644
index 0000000..a81f2b0
--- /dev/null
+++ b/xyz.openbmc_project.Network.conf.in
@@ -0,0 +1,8 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="@BUSNAME_NETWORK@"/>
+ <allow send_destination="@BUSNAME_NETWORK@"/>
+ </policy>
+</busconfig>
diff --git a/xyz.openbmc_project.Network.service.in b/xyz.openbmc_project.Network.service.in
new file mode 100644
index 0000000..65c57ce
--- /dev/null
+++ b/xyz.openbmc_project.Network.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Phosphor Network Manager
+After=obmc-mapper.target
+
+[Service]
+ExecStart=/usr/bin/env phosphor-network-manager
+SyslogIdentifier=phosphor-network-manager
+Restart=always
+Type=dbus
+BusName=@BUSNAME_NETWORK@
+RuntimeDirectory = network
+RuntimeDirectoryPreserve = yes
+StateDirectory = network
+
+[Install]
+WantedBy=@SYSTEMD_TARGET@
OpenPOWER on IntegriCloud