[yocto] [PATCH] Adding support for systemd and its service files

Sujith H sujith.h at gmail.com
Wed Aug 13 04:57:22 PDT 2014


From: Sujith H <Sujith_Haridasan at mentor.com>

Signed-off-by: Muzaffar Mahmood <muzaffar_mahmood at mentor.com>
Signed-off-by: Sujith H <sujith.h at gmail.com>
---
 Makefile.am              |  8 +++++++-
 configure.ac             | 23 ++++++++++++++++++++++-
 psplash-quit.service.in  | 11 +++++++++++
 psplash-start.service.in | 11 +++++++++++
 4 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 psplash-quit.service.in
 create mode 100644 psplash-start.service.in

diff --git a/Makefile.am b/Makefile.am
index c90ebfa..786b3ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,8 +11,14 @@ psplash_write_SOURCES = psplash-write.c psplash.h
 
 EXTRA_DIST = make-image-header.sh
  
-MAINTAINERCLEANFILES = aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh Makefile.in missing
+MAINTAINERCLEANFILES = aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh Makefile.in missing psplash-quit.service  psplash-start.service
 
 snapshot:
 	$(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
 
+if SYSTEMD
+systemdunitdir = @SYSTEMD_UNITDIR@
+
+systemdunit_DATA = psplash-quit.service  psplash-start.service
+endif
+
diff --git a/configure.ac b/configure.ac
index 1284833..a44c8d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,27 @@ fi
 
 AC_SUBST(GCC_FLAGS)
 
+# Check for pkg-config manually first, as if its not installed the
+# PKG_PROG_PKG_CONFIG macro won't be defined.
+AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
+
+if test x"$have_pkg_config" = "xno"; then
+    AC_MSG_ERROR(pkg-config is required to install this program)
+fi
+
+#
+# systemd
+#
+AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
+        [path to systemd service directory]), [path_systemdunit=${withval}],
+                [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
+if (test -n "${path_systemdunit}"); then
+        SYSTEMD_UNITDIR="${path_systemdunit}"
+        AC_SUBST(SYSTEMD_UNITDIR)
+fi
+AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
+
 AC_OUTPUT([
-Makefile
+Makefile psplash-quit.service  psplash-start.service
 ])
+
diff --git a/psplash-quit.service.in b/psplash-quit.service.in
new file mode 100644
index 0000000..14bd499
--- /dev/null
+++ b/psplash-quit.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Terminate Psplash Boot Screen
+After=psplash-start.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/psplash-write QUIT
+TimeoutSec=20
+
+[Install]
+WantedBy=multi-user.target
diff --git a/psplash-start.service.in b/psplash-start.service.in
new file mode 100644
index 0000000..502b150
--- /dev/null
+++ b/psplash-start.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Starts Psplash Boot screen
+Wants=systemd-vconsole-setup.service
+After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service
+DefaultDependencies=no
+
+[Service]
+ExecStart=/usr/bin/psplash
+
+[Install]
+WantedBy=sysinit.target
-- 
1.8.4




More information about the yocto mailing list