bz #836476 - Provide native systemd service
This commit is contained in:
parent
845ef5600d
commit
d759a1073d
11
tcsd.service
Normal file
11
tcsd.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=TCG Core Services Daemon
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/sbin/tcsd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -1,174 +0,0 @@
|
||||
--- dist/fedora/fedora.initrd.tcsd.orig 2010-05-01 13:16:32.000000000 +0200
|
||||
+++ dist/fedora/fedora.initrd.tcsd 2010-05-01 13:16:53.000000000 +0200
|
||||
@@ -1,51 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
-# Init file for the TrouSerS TCG Core Services daemon
|
||||
+# tcsd Init script for the TrouSerS TCG Core Services daemon
|
||||
#
|
||||
# chkconfig: - 90 10
|
||||
# description: TrouSerS server daemon
|
||||
-#
|
||||
-# processname: tcsd
|
||||
-# config: /etc/tcsd.conf
|
||||
-# pidfile: /var/run/tcsd.pid
|
||||
-#
|
||||
-# Return values according to LSB for all commands but status:
|
||||
-# 0 - success
|
||||
-# 1 - generic or unspecified error
|
||||
-# 2 - invalid or excess argument(s)
|
||||
-# 3 - unimplemented feature (e.g. "reload")
|
||||
-# 4 - insufficient privilege
|
||||
-# 5 - program is not installed
|
||||
-# 6 - program is not configured
|
||||
-# 7 - program is not running
|
||||
-#
|
||||
|
||||
+### BEGIN INIT INFO
|
||||
+# Provides:
|
||||
+# Required-Start:
|
||||
+# Required-Stop:
|
||||
+# Should-Start:
|
||||
+# Should-Stop:
|
||||
+# Default-Start: 2 3 4 5
|
||||
+# Default-Stop: 0 1 6
|
||||
+# Short-Description: Init script for TCSD
|
||||
+# Description: TrouSerS TCG Core Services daemon
|
||||
+### END INIT INFO
|
||||
+
|
||||
+exec="/usr/sbin/tcsd"
|
||||
prog="tcsd"
|
||||
+config="/etc/tcsd.conf"
|
||||
+PID_FILE="/var/run/tcsd.pid"
|
||||
+INSMOD="/sbin/insmod"
|
||||
+LSMOD="/sbin/lsmod"
|
||||
+GREP="/bin/grep"
|
||||
|
||||
# source function library
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
+
|
||||
+lockfile=/var/lock/subsys/$prog
|
||||
+
|
||||
# Allow anyone to run status
|
||||
-if [ "$1" = "status" ] ; then
|
||||
- status $prog
|
||||
+if [ "$1" = "status" -o "$1" = "rh_status" -o "$1" = "rh_status_q" ] ; then
|
||||
+ $1 $prog
|
||||
RETVAL=$?
|
||||
exit $RETVAL
|
||||
fi
|
||||
|
||||
# Check that we are root ... so non-root users stop here
|
||||
-test $EUID = 0 || exit 4
|
||||
-
|
||||
-# pull in sysconfig settings
|
||||
-test -f /etc/sysconfig/tcsd && . /etc/sysconfig/tcsd
|
||||
-
|
||||
-RETVAL=0
|
||||
-
|
||||
-# Some variables to make the below more readable
|
||||
-TCSD=/usr/sbin/tcsd
|
||||
-PID_FILE=/var/run/tcsd.pid
|
||||
-INSMOD=/sbin/insmod
|
||||
-LSMOD=/sbin/lsmod
|
||||
-GREP=/bin/grep
|
||||
+test $EUID = 0 || exit 4
|
||||
|
||||
load_drivers()
|
||||
{
|
||||
@@ -64,14 +59,15 @@
|
||||
|
||||
start()
|
||||
{
|
||||
- test -x $TCSD || exit 5
|
||||
- test -f /etc/tcsd.conf || exit 6
|
||||
+ test -x $exec || exit 5
|
||||
+ test -f $config || exit 6
|
||||
check_drivers || load_drivers || failure
|
||||
echo -n $"Starting $prog: "
|
||||
- $TCSD $OPTIONS && success || failure
|
||||
+ $exec $OPTIONS && success || failure
|
||||
RETVAL=$?
|
||||
- [ "$RETVAL" = 0 ] && touch /var/lock/subsys/tcsd
|
||||
echo
|
||||
+ [ "$RETVAL" = 0 ] && touch $lockfile
|
||||
+ return $RETVAL
|
||||
}
|
||||
|
||||
stop()
|
||||
@@ -79,32 +75,59 @@
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $prog
|
||||
RETVAL=$?
|
||||
- [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/tcsd
|
||||
echo
|
||||
+ [ "$RETVAL" = 0 ] && rm -f $lockfile
|
||||
+ return $RETVAL
|
||||
+}
|
||||
+
|
||||
+restart() {
|
||||
+ stop
|
||||
+ start
|
||||
}
|
||||
|
||||
+reload() {
|
||||
+ restart
|
||||
+}
|
||||
+
|
||||
+force_reload() {
|
||||
+ restart
|
||||
+}
|
||||
+
|
||||
+rh_status() {
|
||||
+ # run checks to determine if the service is running or use generic status
|
||||
+ status $prog
|
||||
+}
|
||||
+
|
||||
+rh_status_q() {
|
||||
+ rh_status >/dev/null 2>&1
|
||||
+}
|
||||
+
|
||||
+
|
||||
case "$1" in
|
||||
start)
|
||||
- start
|
||||
+ rh_status_q && exit 0
|
||||
+ $1
|
||||
;;
|
||||
stop)
|
||||
- stop
|
||||
+ rh_status_q || exit 0
|
||||
+ $1
|
||||
;;
|
||||
restart)
|
||||
- test -f /etc/tcsd.conf || exit 6
|
||||
- stop
|
||||
- start
|
||||
+ $1
|
||||
;;
|
||||
- reload|force-reload)
|
||||
- restart
|
||||
+ reload)
|
||||
+ rh_status_q || exit 7
|
||||
+ $1
|
||||
;;
|
||||
+ force-reload)
|
||||
+ force_reload
|
||||
+ ;;
|
||||
condrestart|try-restart)
|
||||
- if [ -f /var/lock/subsys/tcsd ] ; then
|
||||
- restart
|
||||
- fi
|
||||
+ rh_status_q || exit 0
|
||||
+ restart
|
||||
;;
|
||||
*)
|
||||
- echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
|
||||
- RETVAL=3
|
||||
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
+ exit 2
|
||||
esac
|
||||
-exit $RETVAL
|
||||
+exit $?
|
@ -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
|
||||
|
@ -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@redhat.com> 0.3.9-3
|
||||
- bz #836476 - Provide native systemd service
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.9-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user