diff options
| author | Vijay Khemka <vijaykhemka@fb.com> | 2019-06-19 14:25:40 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-06-25 20:48:39 +0000 |
| commit | 55845439f3a34b205420d6bf0e7ef0baf44e14df (patch) | |
| tree | 5ca196645f4b154c99f911958b8e2da6f7f5cde9 | |
| parent | 11d243dfdd647afe471d650c4408627361f2acf3 (diff) | |
| download | phosphor-pid-control-55845439f3a34b205420d6bf0e7ef0baf44e14df.tar.gz phosphor-pid-control-55845439f3a34b205420d6bf0e7ef0baf44e14df.zip | |
Adding service file
Service file for swampd has been added
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: If449c0e943f1a82e9d18599391f0dc68c28009ec
| -rw-r--r-- | Makefile.am | 4 | ||||
| -rw-r--r-- | configure.ac | 25 | ||||
| -rw-r--r-- | phosphor-pid-control.service.in | 12 |
3 files changed, 41 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 3283236..45b26d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,6 +38,10 @@ AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS) +if HAVE_SYSTEMD +systemdsystemunit_DATA = phosphor-pid-control.service +endif + bin_PROGRAMS = swampd setsensor setsensor_SOURCES = setsensor.cpp diff --git a/configure.ac b/configure.ac index b216837..bfc6917 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,27 @@ LT_INIT # Required for systemd linking AC_ARG_ENABLE([tests], AC_HELP_STRING([--disable-tests], [Build test cases])) +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"]) + # Check/set gtest specific functions. AS_IF([test "x$enable_tests" != "xno"], [ PKG_CHECK_MODULES([GTEST], [gtest], [], [true]) @@ -188,6 +209,10 @@ AS_IF([test "x$enable_configure_dbus" = "xyes"], [AC_DEFINE(CONFIGURE_DBUS, [0], [Do not read configuration from D-Bus.])] ) +AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") +AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"]) + # Create configured output AC_CONFIG_FILES([Makefile test/Makefile]) +AC_CONFIG_FILES([phosphor-pid-control.service]) AC_OUTPUT diff --git a/phosphor-pid-control.service.in b/phosphor-pid-control.service.in new file mode 100644 index 0000000..aa29377 --- /dev/null +++ b/phosphor-pid-control.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Phosphor-Pid-Control Margin-based Fan Control Daemon + +[Service] +Restart=always +ExecStart={bindir}/swampd +RestartSec=5 +StartLimitInterval=0 +Type=simple + +[Install] +WantedBy=@SYSTEMD_TARGET@ |

