summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/openct
diff options
context:
space:
mode:
authorLi xin <lixin.fnst@cn.fujitsu.com>2015-01-21 18:19:14 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2015-01-28 09:52:51 +0100
commitce7f238f684ffe0929d8d1629208c2afd818dd65 (patch)
treec83576734148cef54f9d3775101bd99bce178a8f /meta-oe/recipes-support/openct
parentc8f98b15d0a06938e36de91ebf8b2471e50d21d8 (diff)
downloadmeta-openembedded-ce7f238f684ffe0929d8d1629208c2afd818dd65.tar.gz
openct: add new recipe
OpenCT implements drivers for several smart card readers. It comes as driver in ifdhandler format for PC/SC-Lite, as CT-API driver, or as a small and lean middleware, so applications can use it with minimal overhead. OpenCT also has a primitive mechanism to export smart card readers to remote machines via TCP/IP. Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support/openct')
-rw-r--r--meta-oe/recipes-support/openct/openct/etc-openct.udev.in-disablePROGRAM.patch31
-rw-r--r--meta-oe/recipes-support/openct/openct/etc-openct_usb.in-modify-UDEVINFO.patch35
-rw-r--r--meta-oe/recipes-support/openct/openct/openct.init89
-rw-r--r--meta-oe/recipes-support/openct/openct/openct.service13
-rw-r--r--meta-oe/recipes-support/openct/openct/openct.sysconfig5
-rw-r--r--meta-oe/recipes-support/openct/openct_0.6.20.bb92
6 files changed, 265 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/openct/openct/etc-openct.udev.in-disablePROGRAM.patch b/meta-oe/recipes-support/openct/openct/etc-openct.udev.in-disablePROGRAM.patch
new file mode 100644
index 000000000..745f923af
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct/etc-openct.udev.in-disablePROGRAM.patch
@@ -0,0 +1,31 @@
1From e0d3e0bb1e38ff851696a7d8826e651d364ad8ce Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Fri, 5 Dec 2014 02:00:57 +0900
4Subject: [PATCH 1/2] etc/openct.udev.in: disablePROGRAM
5
6Bug fix: https://bugzilla.redhat.com/show_bug.cgi?id=287871
7
8Upstream-status: Pending
9
10Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
11---
12 etc/openct.udev.in | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/etc/openct.udev.in b/etc/openct.udev.in
16index d11d0e1..48083c9 100644
17--- a/etc/openct.udev.in
18+++ b/etc/openct.udev.in
19@@ -22,7 +22,8 @@ ACTION!="add", GOTO="openct_usb_rules_end"
20 # 2010-01-06 removed, as latest udev doesn't know WAIT_FOR_ATTR any more.
21
22 # sleep for 100ms - the wait_for_sysfs might not be enough
23-PROGRAM="/bin/sleep 0.1"
24+# Disabled in this package - see https://bugzilla.redhat.com/287871
25+# PROGRAM="/bin/sleep 0.1"
26
27 # ccid
28 ATTR{bInterfaceClass}=="0b", ATTR{bInterfaceSubClass}=="00", ATTR{bInterfaceProtocol}=="00", ATTRS{idVendor}=="?*" RUN+="@udevdir@/openct_usb /dev/$parent"
29--
301.8.4.2
31
diff --git a/meta-oe/recipes-support/openct/openct/etc-openct_usb.in-modify-UDEVINFO.patch b/meta-oe/recipes-support/openct/openct/etc-openct_usb.in-modify-UDEVINFO.patch
new file mode 100644
index 000000000..d5e3fe575
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct/etc-openct_usb.in-modify-UDEVINFO.patch
@@ -0,0 +1,35 @@
1From d93985a137b553b2723235d03bda341dab14064f Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Fri, 5 Dec 2014 02:04:03 +0900
4Subject: [PATCH 2/2] etc/openct_usb.in: modify UDEVINFO
5
6this patch is from Fedora
7
8Upstream-status: Pending
9
10Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
11---
12 etc/openct_usb.in | 6 +++---
13 1 file changed, 3 insertions(+), 3 deletions(-)
14
15diff --git a/etc/openct_usb.in b/etc/openct_usb.in
16index 32f91aa..917467d 100644
17--- a/etc/openct_usb.in
18+++ b/etc/openct_usb.in
19@@ -15,10 +15,10 @@ if [ -z "$DEVNAME" ]; then
20 # Guess udev info interface.
21 # Newer udev uses udevadm
22 #
23- if which udevinfo > /dev/null 2>&1; then
24- UDEVINFO="udevinfo"
25- else
26+ if which udevadm > /dev/null 2>&1; then
27 UDEVINFO="udevadm info"
28+ else
29+ UDEVINFO="udevinfo"
30 fi
31 DEVNAME=/dev/$($UDEVINFO --query=name --path=$(dirname $DEVPATH))
32 fi
33--
341.8.4.2
35
diff --git a/meta-oe/recipes-support/openct/openct/openct.init b/meta-oe/recipes-support/openct/openct/openct.init
new file mode 100644
index 000000000..c6896095e
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct/openct.init
@@ -0,0 +1,89 @@
1#!/bin/sh
2#
3# openct This shell script takes care of starting and stopping OpenCT.
4#
5# chkconfig: 2345 24 89
6# description: OpenCT is a middleware framework for smart card terminals.
7#
8# processname: ifdhandler
9# config: /etc/openct.conf
10
11### BEGIN INIT INFO
12# Provides: openct
13# Default-Start: 2 3 4 5
14# Default-Stop: 0 1 6
15# Should-Start: $syslog $network
16# Should-Stop: $syslog $network
17# Short-Description: Middleware framework for smart card terminals
18# Description: This starts/stops the OpenCT middleware framework support
19# for smart card terminals.
20### END INIT INFO
21
22. /etc/init.d/functions
23
24exec="/usr/sbin/openct-control"
25prog=openct
26proc=ifdhandler
27
28OPENCT_OPTIONS=
29[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
30
31lockfile=/var/lock/subsys/$prog
32
33start() {
34 retval=0
35 if ! status $proc >/dev/null 2>&1 ; then
36 action $"Initializing OpenCT smart card terminals: " \
37 $exec $OPENCT_OPTIONS init
38 retval=$?
39 [ $retval -eq 0 ] && touch $lockfile
40 fi
41 return $retval
42}
43
44stop() {
45 if status $proc >/dev/null 2>&1 ; then
46 action $"Stopping OpenCT smart card terminals: " \
47 $exec $OPENCT_OPTIONS shutdown
48 fi
49 retval=$?
50 if [ $retval -eq 0 ] ; then
51 rm -f /var/run/openct/status
52 rm -f $lockfile
53 fi
54 return $retval
55}
56
57restart() {
58 stop
59 start
60}
61
62oct_status() {
63 status $proc
64 retval=$?
65 if [ -e /var/run/openct/status ] ; then
66 $exec $OPENCT_OPTIONS status
67 [ -e /var/run/openct/status ] && \
68 echo $"Waiting for reader attach/detach events..."
69 fi
70 return $retval
71}
72
73case "$1" in
74 start|stop|restart)
75 $1
76 ;;
77 reload|force-reload)
78 restart
79 ;;
80 status)
81 oct_status
82 ;;
83 try-restart|condrestart)
84 [ ! -f $lockfile ] || restart
85 ;;
86 *)
87 echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
88 exit 2
89esac
diff --git a/meta-oe/recipes-support/openct/openct/openct.service b/meta-oe/recipes-support/openct/openct/openct.service
new file mode 100644
index 000000000..c9ec497fa
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct/openct.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Openct Middleware framework for smart card terminals
3After=syslog.target network.target
4
5[Service]
6EnvironmentFile=-/etc/sysconfig/openct
7ExecStart=/usr/sbin/openct-control $OPENCT_OPTIONS init
8ExecStop=/usr/sbin/openct-control $OPENCT_OPTIONS shutdown
9RemainAfterExit=yes
10KillMode=none
11
12[Install]
13WantedBy=multi-user.target
diff --git a/meta-oe/recipes-support/openct/openct/openct.sysconfig b/meta-oe/recipes-support/openct/openct/openct.sysconfig
new file mode 100644
index 000000000..ffc270790
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct/openct.sysconfig
@@ -0,0 +1,5 @@
1# -*- sh -*-
2# Extra options to pass to openct-control.
3# Consult "/usr/sbin/openct-control -h" for available options.
4#
5OPENCT_OPTIONS=""
diff --git a/meta-oe/recipes-support/openct/openct_0.6.20.bb b/meta-oe/recipes-support/openct/openct_0.6.20.bb
new file mode 100644
index 000000000..70c73fd6e
--- /dev/null
+++ b/meta-oe/recipes-support/openct/openct_0.6.20.bb
@@ -0,0 +1,92 @@
1Summanry = "Middleware framework for smart card terminals"
2DESCRIPTION = " \
3OpenCT implements drivers for several smart card readers. \
4It comes as driver in ifdhandler format for PC/SC-Lite, \
5as CT-API driver, or as a small and lean middleware, \
6so applications can use it with minimal overhead. \
7OpenCT also has a primitive mechanism to export smart card \
8readers to remote machines via TCP/IP."
9
10DEPENDS += "libtool pcsc-lite libusb-compat"
11
12SRC_URI = " \
13 ${DEBIAN_MIRROR}/main/o/${PN}/${PN}_${PV}.orig.tar.gz \
14 file://etc-openct.udev.in-disablePROGRAM.patch \
15 file://etc-openct_usb.in-modify-UDEVINFO.patch \
16 file://openct.init \
17 file://openct.sysconfig \
18 file://openct.service \
19"
20
21SRC_URI[md5sum] = "a1da3358ab798f1cb9232f1dbababc21"
22SRC_URI[sha256sum] = "6cd3e2933d29eb1f875c838ee58b8071fd61f0ec8ed5922a86c01c805d181a68"
23
24LICENSE = "LGPLv2+"
25LIC_FILES_CHKSUM = "file://LGPL-2.1;md5=2d5025d4aa3495befef8f17206a5b0a1"
26
27inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
28SYSTEMD_SERVICE_${PN} += "openct.service "
29SYSTEMD_AUTO_ENABLE = "enable"
30
31EXTRA_OECONF=" \
32 --disable-static \
33 --enable-usb \
34 --enable-pcsc \
35 --enable-doc \
36 --enable-api-doc \
37 --with-udev=/lib/udev \
38 --with-bundle=${libdir}/pcsc/drivers \
39"
40
41inherit autotools pkgconfig
42
43FILES_${PN} += " \
44 ${libdir}/ctapi \
45 /lib/udev \
46 ${libdir}/openct-ifd.so \
47 ${libdir}/pcsc \
48 /run/openct/status \
49"
50
51FILES_${PN}-dbg += " \
52 ${libdir}/ctapi/.debug \
53 ${libdir}/pcsc/drivers/openct-ifd.bundle/Contents/Linux/.debug \
54"
55
56INSANE_SKIP_${PN} += "dev-deps"
57
58
59do_install () {
60 rm -rf ${D}
61 install -d ${D}/etc
62 install -dm 755 ${D}/lib/udev
63 # fix up hardcoded paths
64 sed -i -e 's,/etc/,${sysconfdir}/,' -e 's,/usr/sbin/,${sbindir}/,' \
65 ${WORKDIR}/openct.service ${WORKDIR}/openct.init
66
67 oe_runmake install DESTDIR=${D}
68 install -dm 755 ${D}${libdir}/ctapi/
69 mv ${D}${libdir}/libopenctapi.so ${D}${libdir}/ctapi/
70 install -Dpm 644 etc/openct.udev ${D}/etc/udev/rules.d/60-openct.rules
71 install -pm 644 etc/openct.conf ${D}/etc/openct.conf
72
73 install -Dpm 755 ${WORKDIR}/openct.init ${D}/etc/init.d/openct
74 install -Dpm 644 ${WORKDIR}/openct.sysconfig ${D}/etc/sysconfig/openct
75
76 if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
77 install -d ${D}/${systemd_unitdir}/system
78 install -m 644 ${WORKDIR}/openct.service ${D}/${systemd_unitdir}/system
79 fi
80
81 so=$(find ${D} -name \*.so | sed "s|^${D}||")
82 sed -i -e 's|\\(LIBPATH\\s*\\).*|\\1$so|' etc/reader.conf
83 install -Dpm 644 etc/reader.conf ${D}/etc/reader.conf.d/openct.conf
84
85 install -dm 755 ${D}${localstatedir}/run/openct
86 touch ${D}${localstatedir}/run/openct/status
87 chmod 644 ${D}${localstatedir}/run/openct/status
88}
89
90pkg_postinst_${PN} () {
91 ln -sf ctapi/libopenctapi.so ${libdir}/libopenctapi.so
92}