Permalink
Browse files

uuidd: add systemd unit files

Add systemd unit files which use the socket activation mechanism
of systemd. The uuidd deamon is started upon first request on the
socket and quits after 1 minute of inactivity.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
  • Loading branch information...
1 parent 7ec85b5 commit 1b68c37927c193d10195b7f1ba03f9b6e3ff389e @knot knot committed with karelzak May 3, 2012
Showing with 40 additions and 3 deletions.
  1. +2 −1 Makefile.am
  2. +11 −0 configure.ac
  3. +1 −0 misc-utils/.gitignore
  4. +9 −2 misc-utils/Makefile.am
  5. +9 −0 misc-utils/uuidd.service.in
  6. +8 −0 misc-utils/uuidd.socket
View
@@ -89,7 +89,8 @@ checkxalloc:
ENABLE_ALL = --enable-static-programs --enable-most-builds
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --disable-use-tty-group \
- --disable-silent-rules $(ENABLE_ALL)
+ --disable-silent-rules $(ENABLE_ALL) \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
BUILT_SOURCES = .version
View
@@ -1142,6 +1142,16 @@ if test "x$enable_socket_activation" = xyes; then
AC_DEFINE(USE_SOCKET_ACTIVATION, 1, [Should uuidd support socket activation?])
fi
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+
+if test "x$with_systemdsystemunitdir" != "xno"; then
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+
+AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
+
AC_ARG_ENABLE([login-stat-mail],
AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
@@ -1265,6 +1275,7 @@ libuuid/uuid.pc
login-utils/Makefile
man/ru/Makefile
misc-utils/Makefile
+misc-utils/uuidd.service
mount/Makefile
partx/Makefile
po/Makefile.in
View
@@ -18,3 +18,4 @@ wipefs
findmnt
lsblk
lslocks
+uuidd.service
View
@@ -1,7 +1,5 @@
include $(top_srcdir)/config/include-Makefile.am
-EXTRA_DIST = uuidd.rc
-
bin_PROGRAMS =
sbin_PROGRAMS =
usrsbin_exec_PROGRAMS =
@@ -89,8 +87,17 @@ if USE_SOCKET_ACTIVATION
uuidd_SOURCES += sd-daemon.c
uuidd_LDADD += -lrt
endif
+if WITH_SYSTEMD
+systemdsystemunit_DATA = \
+ uuidd.service \
+ uuidd.socket
+endif
endif
+EXTRA_DIST = uuidd.rc uuidd.service.in uuidd.socket
+CLEANFILES += uuidd.service
+
+
if BUILD_LIBBLKID
sbin_PROGRAMS += blkid findfs wipefs
dist_man_MANS += blkid.8 findfs.8 wipefs.8
@@ -0,0 +1,9 @@
+[Unit]
+Description=Daemon for generating UUIDs
+Requires=uuidd.socket
+
+[Service]
+ExecStart=@sbindir@/uuidd -S -T 60
+Restart=no
+User=uuidd
+Group=uuidd
View
@@ -0,0 +1,8 @@
+[Unit]
+Description=UUID daemon activation socket
+
+[Socket]
+ListenStream=/var/run/uuidd/request
+
+[Install]
+WantedBy=sockets.target

0 comments on commit 1b68c37

Please sign in to comment.