diff --git a/README.md b/README.md index e7253e4..8cc17bd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # libopenct +OpenCT is a library for accessing smart card terminals. +It provides a rich set of functions for driver writers, protocol drivers for T=0 and T=1, serial and USB functionality, including USB hotplugging. +OpenCT provides a native OpenCT, CT-API and PC/SC Lite IFD interface with an OpenCT ifdhandler resource manager. + diff --git a/libopenct.initscript b/libopenct.initscript new file mode 100644 index 0000000..ef99958 --- /dev/null +++ b/libopenct.initscript @@ -0,0 +1,73 @@ +#!/bin/sh +# +# openct This shell script takes care of starting and stopping OpenCT. +# +# chkconfig: 2345 24 89 +# description: OpenCT is a middleware framework for smart card terminals. +# +# processname: ifdhandler +# config: /etc/openct.conf + +### BEGIN INIT INFO +# Provides: openct +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Should-Start: $syslog $network +# Should-Stop: $syslog $network +# Short-Description: Middleware framework for smart card terminals +### END INIT INFO + +. /etc/sysconfig/rc + +# Source function library. +[ -r "$rc_functions" ] && . $rc_functions + +NAME=openct +DAEMON=/usr/sbin/openct-control +PROC=ifdhandler +OPTIONS= +[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME + +case "$1" in + start) + RETVAL=0 + if ! status $PROC >/dev/null 2>&1 ; then + action $"Initializing OpenCT smart card terminals: " \ + $DAEMON $OPENCT_OPTIONS init + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME + fi + ;; + stop) + if status $PROC >/dev/null 2>&1 ; then + action $"Stopping OpenCT smart card terminals: " \ + $DAEMON $OPENCT_OPTIONS shutdown + fi + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + rm -f /var/run/openct/status + rm -f /var/lock/subsys/$NAME + fi + ;; + restart|reload|force-reload) + $0 stop + sleep 1 + $0 start + ;; + status) + statusproc $PROC + RETVAL=$? + if [ -e /var/run/openct/status ] ; then + $DAEMON $OPENCT_OPTIONS status + [ -e /var/run/openct/status ] && \ + echo $"Waiting for reader attach/detach events..." + fi + ;; + try-restart|condrestart) + [ -e /var/lock/subsys/$NAME ] && $0 restart || : + ;; + *) + echo $"Usage: ""$0 {start|stop|status|restart|try-restart|reload|force-reload}" + exit 1 + ;; +esac diff --git a/libopenct.spec b/libopenct.spec new file mode 100644 index 0000000..62c8505 --- /dev/null +++ b/libopenct.spec @@ -0,0 +1,168 @@ +%define bundledir %(pkg-config libpcsclite --variable=usbdropdir) + +Name: libopenct +Version: 0.6.20 +Release: 1mamba +Summary: OpenCT is a library for accessing smart card terminals +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Aleph0 +URL: http://www.opensc.org/ +Source0: http://www.opensc-project.org/files/openct/openct-%{version}.tar.gz +Source1: %{name}.initscript +Source2: %{name}.sysconfig +License: LGPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libltdl-devel +BuildRequires: libpcsclite-devel +BuildRequires: libusb0-devel +## AUTOBUILDREQ-END +BuildRequires: flex +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +OpenCT is a library for accessing smart card terminals. +It provides a rich set of functions for driver writers, protocol drivers for T=0 and T=1, serial and USB functionality, including USB hotplugging. +OpenCT provides a native OpenCT, CT-API and PC/SC Lite IFD interface with an OpenCT ifdhandler resource manager. + +%package devel +Summary: Devel package for %{name} +Group: Development/Libraries +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +OpenCT is a library for accessing smart card terminals. +This package contains static libraries and header files need for development. + +%prep +%setup -q -n openct-%{version} + +%build +%configure \ + --disable-static \ + --with-bundle=%{bundledir} \ + --enable-pcsc \ + --enable-usb \ + --enable-api-doc \ + --with-udev=/lib/udev +%make + +%install +[ "%{buildroot}" != / ] && rm -rf %{buildroot} +install -dm 755 %{buildroot}/lib/udev +%makeinstall + +install -d .m 755 %{buildroot}%{_libdir}/ctapi +mv %{buildroot}%{_libdir}/{libopenctapi.la,libopenctapi.so,ctapi} + +install -D -m 644 etc/openct.udev \ + %{buildroot}%{_sysconfdir}/udev/rules.d/60-openct.rules +#install -D -m 644 etc/openct.conf %{buildroot}%{_sysconfdir}/reader.conf.d/openct.conf + +#so=$(find %{buildroot}%{bundledir} -name \*.so | sed "s|^%{buildroot}||") +#sed -i -e "s|\\(LIBPATH\\s*\\).*|\\1$so|" etc/reader.conf.d/reader.conf +#install -Dpm 644 etc/reader.conf \ +# %{buildroot}%{_sysconfdir}/reader.conf.d/%{name}.conf + +install -d -m 755 %{buildroot}%{_localstatedir}/run/openct +touch %{buildroot}%{_localstatedir}/run/openct/status +chmod 644 %{buildroot}%{_localstatedir}/run/openct/status + +install -D -m 755 %{S:1} %{buildroot}%{_initrddir}/openct +install -D -m 644 %{S:2} %{buildroot}%{_sysconfdir}/sysconfig/openct + +%clean +[ "%{buildroot}" != / ] && rm -rf %{buildroot} + +%post +if [ $1 -eq 1 ]; then + /sbin/ldconfig + /sbin/chkconfig --add openct +fi +touch %{_localstatedir}/run/openct/status +exit 0 + +%preun +if [ $1 -eq 0 ]; then + /sbin/chkconfig --del openct + service openct stop 2>/dev/null +fi +exit 0 + +%postun +if [ $1 -eq 1 ]; then + service openct condrestart +fi +/sbin/ldconfig +exit 0 + +%files +%defattr(-,root,root) +%{_bindir}/openct-tool +%{_sbindir}/ifdhandler +%{_sbindir}/ifdproxy +%{_sbindir}/openct-control +%{_libdir}/libopenct.so.* +/lib/udev/openct_pcmcia +/lib/udev/openct_serial +/lib/udev/openct_usb +%{_initrddir}/openct +%config(noreplace) %{_sysconfdir}/openct.conf +#%config(noreplace) %{_sysconfdir}/reader.conf.d/libopenct.conf +#%config(noreplace) %{_sysconfdir}/reader.conf.d/openct.conf +%config(noreplace) %{_sysconfdir}/sysconfig/openct +%config(noreplace) %{_sysconfdir}/udev/rules.d/*openct.rules +%{bundledir}/openct-ifd.bundle/ +%{_mandir}/man1/openct-tool.* +%dir %{_localstatedir}/run/openct/ +%ghost %{_localstatedir}/run/openct/status +%doc LGPL-2.1 NEWS TODO + +%files devel +%defattr(-,root,root) +%{_libdir}/libopenct.la +%{_libdir}/libopenct.so +%{_libdir}/openct-ifd.la +%{_libdir}/openct-ifd.so +%{_libdir}/ctapi/libopenctapi.la +%{_libdir}/ctapi/libopenctapi.so +#%{_libdir}/openct-ifd.la +#%{_libdir}/openct-ifd.so +%{_includedir}/openct +%{_libdir}/pkgconfig/libopenct.pc +%{_docdir}/openct/api/* +%{_docdir}/openct/NEWS +%{_docdir}/openct/README + +%changelog +* Tue Apr 27 2010 Automatic Build System 0.6.20-1mamba +- automatic update by autodist + +* Thu Jan 28 2010 Silvan Calarco 0.6.19-2mamba +- touch /var/run/openct/status on install +- don't install build time prepared readers.d/libopenct.conf to prevent problems with pcscd initscript using update-reader.conf +- fix udev libexec files installation and rules configuration +- fixed bundledir configuration + +* Wed Jan 20 2010 Automatic Build System 0.6.19-1mamba +- automatic update by autodist + +* Thu Oct 01 2009 Automatic Build System 0.6.18-1mamba +- automatic update by autodist + +* Fri Jul 31 2009 Automatic Build System 0.6.17-1mamba +- automatic update by autodist + +* Sat May 23 2009 Automatic Build System 0.6.16-1mamba +- automatic update by autodist + +* Mon Dec 08 2008 Silvan Calarco 0.6.15-1mamba +- automatic update by autodist + +* Wed Nov 28 2007 Aleph0 0.6.14-1mamba +- update to 0.6.14 + +* Tue Dec 07 2004 Davide Madrisan 0.6.2-1qilnx +- package created by autospec diff --git a/libopenct.sysconfig b/libopenct.sysconfig new file mode 100644 index 0000000..6bbdfd4 --- /dev/null +++ b/libopenct.sysconfig @@ -0,0 +1,5 @@ +# -*- sh -*- +# Extra options to pass to openct-control. +# Consult "/usr/sbin/openct-control -h" for available options. +# +OPTIONS=""