pcsc-lite/0003-Install-systemd-service-files.patch

145 lines
4.0 KiB
Diff
Raw Normal View History

From 0f85375fd8949e529a6f46c07cdabda74040fd8a Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalev@smartlink.ee>
Date: Fri, 24 Jun 2011 22:32:33 +0300
Subject: [PATCH 3/3] Install systemd service files
---
PCSC/Makefile.am | 5 ++++-
PCSC/configure.in | 32 ++++++++++++++++++++++----------
PCSC/etc/Makefile.am | 9 +++++++++
PCSC/etc/pcscd.service.in | 13 +++++++++++++
PCSC/etc/pcscd.socket.in | 8 ++++++++
5 files changed, 56 insertions(+), 11 deletions(-)
create mode 100644 PCSC/etc/Makefile.am
create mode 100644 PCSC/etc/pcscd.service.in
create mode 100644 PCSC/etc/pcscd.socket.in
diff --git a/PCSC/Makefile.am b/PCSC/Makefile.am
index 079b58a..c515128 100644
--- a/PCSC/Makefile.am
+++ b/PCSC/Makefile.am
@@ -1,10 +1,13 @@
-SUBDIRS = m4 src doc
+SUBDIRS = m4 src etc doc
fix-rights:
$(MAKE) -C src $@
ACLOCAL_AMFLAGS = -I m4
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
EXTRA_DIST = DRIVERS SECURITY bootstrap HELP ChangeLog.svn
DISTCLEANFILES = ChangeLog.svn
diff --git a/PCSC/configure.in b/PCSC/configure.in
index 97e3360..cc6fe5f 100644
--- a/PCSC/configure.in
+++ b/PCSC/configure.in
@@ -274,6 +274,14 @@ if test x$use_libusb = xyes; then
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libusb"
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(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
# --disable-autostart
AC_ARG_ENABLE(autostart,
AC_HELP_STRING([--disable-autostart], [disable pcscd automatic startup]),
@@ -383,17 +391,18 @@ PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
PTHREAD_LIBS: ${PTHREAD_LIBS}
PCSC_ARCH: ${PCSC_ARCH}
-pcscd binary ${PCSCD_BINARY}
-libudev support: ${use_libudev}
-libusb support: ${use_libusb}
-USB drop directory: ${usbdropdir}
-ATR parsing messages: ${debugatr}
-ipcdir: ${ipcdir}
-use serial: ${use_serial}
-use usb: ${use_usb}
-use autostart: ${use_autostart}
+pcscd binary ${PCSCD_BINARY}
+libudev support: ${use_libudev}
+libusb support: ${use_libusb}
+USB drop directory: ${usbdropdir}
+ATR parsing messages: ${debugatr}
+ipcdir: ${ipcdir}
+use serial: ${use_serial}
+use usb: ${use_usb}
+use autostart: ${use_autostart}
+systemd unit directory: ${with_systemdsystemunitdir}
-PCSCLITE_FEATURES: ${PCSCLITE_FEATURES}
+PCSCLITE_FEATURES: ${PCSCLITE_FEATURES}
EOF
@@ -406,6 +415,9 @@ doc/doxygen.conf
doc/pcscd.8
doc/reader.conf.5
doc/example/Makefile
+etc/Makefile
+etc/pcscd.service
+etc/pcscd.socket
src/Makefile
src/libpcsclite.pc
src/pcscd.h
diff --git a/PCSC/etc/Makefile.am b/PCSC/etc/Makefile.am
new file mode 100644
index 0000000..6ab04fc
--- /dev/null
+++ b/PCSC/etc/Makefile.am
@@ -0,0 +1,9 @@
+if HAVE_SYSTEMD
+SCRIPT_IN_FILES = \
+ pcscd.service.in \
+ pcscd.socket.in
+
+systemdsystemunit_DATA = \
+ pcscd.service \
+ pcscd.socket
+endif
diff --git a/PCSC/etc/pcscd.service.in b/PCSC/etc/pcscd.service.in
new file mode 100644
index 0000000..4800d32
--- /dev/null
+++ b/PCSC/etc/pcscd.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=PC/SC Smart Card Daemon
+Requires=pcscd.socket
+After=syslog.target
+
+[Service]
+ExecStart=@sbindir_exp@/pcscd -f
+ExecReload=@sbindir_exp@/pcscd -H
+StandardOutput=syslog
+
+[Install]
+WantedBy=multi-user.target
+Also=pcscd.socket
diff --git a/PCSC/etc/pcscd.socket.in b/PCSC/etc/pcscd.socket.in
new file mode 100644
index 0000000..6fc93da
--- /dev/null
+++ b/PCSC/etc/pcscd.socket.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=PC/SC Smart Card Daemon Activation Socket
+
+[Socket]
+ListenStream=@ipcdir@/pcscd.comm
+
+[Install]
+WantedBy=sockets.target
--
1.7.5.4