diff options
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 0000000000..745f923af1 --- /dev/null +++ b/meta-oe/recipes-support/openct/openct/etc-openct.udev.in-disablePROGRAM.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From e0d3e0bb1e38ff851696a7d8826e651d364ad8ce Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Fri, 5 Dec 2014 02:00:57 +0900 | ||
| 4 | Subject: [PATCH 1/2] etc/openct.udev.in: disablePROGRAM | ||
| 5 | |||
| 6 | Bug fix: https://bugzilla.redhat.com/show_bug.cgi?id=287871 | ||
| 7 | |||
| 8 | Upstream-status: Pending | ||
| 9 | |||
| 10 | Signed-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 | |||
| 15 | diff --git a/etc/openct.udev.in b/etc/openct.udev.in | ||
| 16 | index 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 | -- | ||
| 30 | 1.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 0000000000..d5e3fe5753 --- /dev/null +++ b/meta-oe/recipes-support/openct/openct/etc-openct_usb.in-modify-UDEVINFO.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From d93985a137b553b2723235d03bda341dab14064f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Fri, 5 Dec 2014 02:04:03 +0900 | ||
| 4 | Subject: [PATCH 2/2] etc/openct_usb.in: modify UDEVINFO | ||
| 5 | |||
| 6 | this patch is from Fedora | ||
| 7 | |||
| 8 | Upstream-status: Pending | ||
| 9 | |||
| 10 | Signed-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 | |||
| 15 | diff --git a/etc/openct_usb.in b/etc/openct_usb.in | ||
| 16 | index 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 | -- | ||
| 34 | 1.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 0000000000..c6896095e3 --- /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 | |||
| 24 | exec="/usr/sbin/openct-control" | ||
| 25 | prog=openct | ||
| 26 | proc=ifdhandler | ||
| 27 | |||
| 28 | OPENCT_OPTIONS= | ||
| 29 | [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog | ||
| 30 | |||
| 31 | lockfile=/var/lock/subsys/$prog | ||
| 32 | |||
| 33 | start() { | ||
| 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 | |||
| 44 | stop() { | ||
| 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 | |||
| 57 | restart() { | ||
| 58 | stop | ||
| 59 | start | ||
| 60 | } | ||
| 61 | |||
| 62 | oct_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 | |||
| 73 | case "$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 | ||
| 89 | esac | ||
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 0000000000..c9ec497fa5 --- /dev/null +++ b/meta-oe/recipes-support/openct/openct/openct.service | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Openct Middleware framework for smart card terminals | ||
| 3 | After=syslog.target network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | EnvironmentFile=-/etc/sysconfig/openct | ||
| 7 | ExecStart=/usr/sbin/openct-control $OPENCT_OPTIONS init | ||
| 8 | ExecStop=/usr/sbin/openct-control $OPENCT_OPTIONS shutdown | ||
| 9 | RemainAfterExit=yes | ||
| 10 | KillMode=none | ||
| 11 | |||
| 12 | [Install] | ||
| 13 | WantedBy=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 0000000000..ffc270790f --- /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 | # | ||
| 5 | OPENCT_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 0000000000..70c73fd6e6 --- /dev/null +++ b/meta-oe/recipes-support/openct/openct_0.6.20.bb | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | Summanry = "Middleware framework for smart card terminals" | ||
| 2 | DESCRIPTION = " \ | ||
| 3 | OpenCT implements drivers for several smart card readers. \ | ||
| 4 | It comes as driver in ifdhandler format for PC/SC-Lite, \ | ||
| 5 | as CT-API driver, or as a small and lean middleware, \ | ||
| 6 | so applications can use it with minimal overhead. \ | ||
| 7 | OpenCT also has a primitive mechanism to export smart card \ | ||
| 8 | readers to remote machines via TCP/IP." | ||
| 9 | |||
| 10 | DEPENDS += "libtool pcsc-lite libusb-compat" | ||
| 11 | |||
| 12 | SRC_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 | |||
| 21 | SRC_URI[md5sum] = "a1da3358ab798f1cb9232f1dbababc21" | ||
| 22 | SRC_URI[sha256sum] = "6cd3e2933d29eb1f875c838ee58b8071fd61f0ec8ed5922a86c01c805d181a68" | ||
| 23 | |||
| 24 | LICENSE = "LGPLv2+" | ||
| 25 | LIC_FILES_CHKSUM = "file://LGPL-2.1;md5=2d5025d4aa3495befef8f17206a5b0a1" | ||
| 26 | |||
| 27 | inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)} | ||
| 28 | SYSTEMD_SERVICE_${PN} += "openct.service " | ||
| 29 | SYSTEMD_AUTO_ENABLE = "enable" | ||
| 30 | |||
| 31 | EXTRA_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 | |||
| 41 | inherit autotools pkgconfig | ||
| 42 | |||
| 43 | FILES_${PN} += " \ | ||
| 44 | ${libdir}/ctapi \ | ||
| 45 | /lib/udev \ | ||
| 46 | ${libdir}/openct-ifd.so \ | ||
| 47 | ${libdir}/pcsc \ | ||
| 48 | /run/openct/status \ | ||
| 49 | " | ||
| 50 | |||
| 51 | FILES_${PN}-dbg += " \ | ||
| 52 | ${libdir}/ctapi/.debug \ | ||
| 53 | ${libdir}/pcsc/drivers/openct-ifd.bundle/Contents/Linux/.debug \ | ||
| 54 | " | ||
| 55 | |||
| 56 | INSANE_SKIP_${PN} += "dev-deps" | ||
| 57 | |||
| 58 | |||
| 59 | do_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 | |||
| 90 | pkg_postinst_${PN} () { | ||
| 91 | ln -sf ctapi/libopenctapi.so ${libdir}/libopenctapi.so | ||
| 92 | } | ||
