[trousers/f18] bz #836476 - Provide native systemd service

Steve Grubb sgrubb at fedoraproject.org
Mon Aug 27 17:22:38 UTC 2012


commit a0735e4a95f5e1a7b65673ff26238812d062df1c
Author: Steve <sgrubb at redhat.com>
Date:   Mon Aug 27 13:22:35 2012 -0400

    bz #836476 - Provide native systemd service

 tcsd.service             |   11 +++
 trousers-init.patch      |  174 ----------------------------------------------
 trousers-no-werror.patch |    8 +-
 trousers.spec            |   47 +++++++------
 4 files changed, 41 insertions(+), 199 deletions(-)
---
diff --git a/tcsd.service b/tcsd.service
new file mode 100644
index 0000000..25647fd
--- /dev/null
+++ b/tcsd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=TCG Core Services Daemon
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStart=/sbin/tcsd
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/trousers-no-werror.patch b/trousers-no-werror.patch
index 58d60fb..f8697ab 100644
--- a/trousers-no-werror.patch
+++ b/trousers-no-werror.patch
@@ -1,7 +1,7 @@
-diff -ur trousers-0.3.6.orig/configure trousers-0.3.6/configure
---- trousers-0.3.6.orig/configure	2011-04-08 09:09:38.000000000 -0400
-+++ trousers-0.3.6/configure	2011-04-08 09:41:49.000000000 -0400
-@@ -14379,7 +14379,7 @@
+diff -ur trousers-0.3.9.orig/configure trousers-0.3.9/configure
+--- trousers-0.3.9.orig/configure	2012-05-30 11:16:40.000000000 -0400
++++ trousers-0.3.9/configure	2012-08-27 12:39:14.432278839 -0400
+@@ -13503,7 +13503,7 @@
  
  
  if test "x${GCC}" = "xyes"; then
diff --git a/trousers.spec b/trousers.spec
index 2c743d5..fa5fa9c 100644
--- a/trousers.spec
+++ b/trousers.spec
@@ -1,22 +1,21 @@
 Name: trousers
 Summary: TCG's Software Stack v1.2
 Version: 0.3.9
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: CPL
 Group: System Environment/Libraries
 Url: http://trousers.sourceforge.net
 Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
-# Patch init script to conform to our guidelines
-Patch1: trousers-init.patch
+Source1: tcsd.service
 # We have newer compiler which has new warnings
-Patch2: trousers-no-werror.patch
+Patch1: trousers-no-werror.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libtool, openssl-devel
+BuildRequires: systemd-units
 Requires(pre): shadow-utils
-Requires(post): chkconfig
-Requires(preun): chkconfig
-Requires(preun): initscripts
-Requires(postun): initscripts
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 TrouSerS is an implementation of the Trusted Computing Group's Software Stack
@@ -47,8 +46,7 @@ applications.
 
 %prep
 %setup -q
-%patch1 -p0
-%patch2 -p1
+%patch1 -p1
 
 sed -i -e 's|/var/tpm|/var/lib/tpm|g' -e 's|/usr/local/var|/var|g' man/man5/tcsd.conf.5.in man/man8/tcsd.8.in
 
@@ -60,10 +58,10 @@ make -k %{?_smp_mflags}
 %install
 rm -rf ${RPM_BUILD_ROOT}
 mkdir -p ${RPM_BUILD_ROOT}/%{_localstatedir}/lib/tpm
-mkdir -p ${RPM_BUILD_ROOT}/%{_initrddir}
-cp -p dist/fedora/fedora.initrd.tcsd ${RPM_BUILD_ROOT}/%{_initrddir}/tcsd
 make install DESTDIR=${RPM_BUILD_ROOT} INSTALL="install -p"
 rm -f ${RPM_BUILD_ROOT}/%{_libdir}/libtspi.la
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
 
 %clean
 rm -rf ${RPM_BUILD_ROOT}
@@ -76,19 +74,23 @@ useradd -r -u 59 -g tss -d /dev/null -s /sbin/nologin \
 exit 0
 
 %post
-/sbin/ldconfig
-/sbin/chkconfig --add tcsd
+if [ $1 -eq 1 ] ; then
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 = 0 ]; then
-	/sbin/service tcsd stop > /dev/null 2>&1
-	/sbin/chkconfig --del tcsd
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable tcsd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop tcsd.service > /dev/null 2>&1 || :
 fi
 
 %postun
-/sbin/ldconfig
-if [ $1 -gt 1 ]; then
-	/sbin/service tcsd condrestart > /dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart tcsd.service >/dev/null 2>&1 || :
 fi
 
 %files
@@ -100,7 +102,7 @@ fi
 %config(noreplace) %attr(0600, tss, tss) %{_sysconfdir}/tcsd.conf
 %doc %{_mandir}/man5/*
 %doc %{_mandir}/man8/*
-%{_initrddir}/tcsd
+%attr(755,root,root) %{_unitdir}/tcsd.service
 %attr(0700, tss, tss) %{_localstatedir}/lib/tpm/
 
 %files devel
@@ -118,6 +120,9 @@ fi
 %{_libdir}/libtddl.a
 
 %changelog
+* Mon Aug 27 2012 Steve Grubb <sgrubb at redhat.com> 0.3.9-3
+- bz #836476 - Provide native systemd service
+
 * Sun Jul 22 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3.9-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list