[tclhttpd] convert to systemd
Tom Callaway
spot at fedoraproject.org
Tue Sep 20 18:59:57 UTC 2011
commit 14ea3b3f354981e48f6065b94fece57fdbf7bf28
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date: Tue Sep 20 14:59:42 2011 -0400
convert to systemd
tclhttpd.service | 10 +++++++++
tclhttpd.spec | 55 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 45 insertions(+), 20 deletions(-)
---
diff --git a/tclhttpd.service b/tclhttpd.service
new file mode 100644
index 0000000..f7da81a
--- /dev/null
+++ b/tclhttpd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Tcl Based Web Server
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/bin/tclhttpd -config /etc/tclhttpd/tclhttpd.rc -docRoot /var/www/tclhttpd/htdocs -library /var/www/tclhttpd/custom
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/tclhttpd.spec b/tclhttpd.spec
index 42832ea..e702cc2 100644
--- a/tclhttpd.spec
+++ b/tclhttpd.spec
@@ -4,25 +4,27 @@
%define contentdir %_var/www/tclhttpd
Name: tclhttpd
Version: 3.5.1
-Release: 22%{?dist}
+Release: 23%{?dist}
Summary: Extensible Web+Application server written in Tcl
Group: System Environment/Daemons
License: TCL and BSD with advertising
URL: http://tclhttpd.sourceforge.net/
Source0: http://downloads.sourceforge.net/tclhttpd/tclhttpd3.5.1.tar.gz
+Source1: tclhttpd.service
Patch0: tclhttpd_fedora.1.patch
Patch1: tclhttpd-md5-3.5.1.patch
Patch2: tclhttpd-3.5.1-nofork.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: tcl-devel
+BuildRequires: systemd-units
+
Requires: tcl(abi) = 8.5 tclx tcllib
Requires(pre): shadow-utils
-Requires(post): /sbin/chkconfig
-Requires(post): /sbin/service
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
TclHttpd is a Web server implemented in pure Tcl. It works out of the box as a
@@ -40,10 +42,9 @@ HTML+Tcl templates, and is extensible in a variety of ways.
make %{?_smp_mflags}
%install
-rm -rf $RPM_BUILD_ROOT
-
make install DESTDIR=$RPM_BUILD_ROOT
-install -p -D bin/redhat.init.tclhttpd $RPM_BUILD_ROOT/%{_initrddir}/tclhttpd
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+install -p -D %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/
mkdir -p $RPM_BUILD_ROOT%_var/run/tclhttpd
# Move some of the libraries around so that we don't pollute the libdir.
@@ -109,25 +110,36 @@ if [ x"$user_uid" = x ] ; then
fi
%post
-/sbin/chkconfig --add tclhttpd
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ "$1" = "0" ]; then
- /sbin/service tclhttpd stop > /dev/null 2>&1
- /sbin/chkconfig --del tclhttpd
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable tclhttpd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop tclhttpd.service > /dev/null 2>&1 || :
fi
%postun
-
-if [ "$1" -ge "1" ]; then
- /sbin/service tclhttpd 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 tclhttpd.service >/dev/null 2>&1 || :
fi
-%clean
-rm -rf $RPM_BUILD_ROOT
+%triggerun -- tclhttpd < 3.5.1-23
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply tclhttpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save tclhttpd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del tclhttpd >/dev/null 2>&1 || :
+/bin/systemctl try-restart tclhttpd.service >/dev/null 2>&1 || :
%files
-%defattr(-,root,root)
%doc README README.* WHATSNEW license.terms
%{_datadir}/%{name}%{version}
%{_bindir}/tclhttpd
@@ -136,7 +148,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %contentdir
%dir %attr(-,tclhttpd,tclhttpd) %{_var}/run/tclhttpd
%attr(-,tclhttpd,tclhttpd) %{_var}/log/tclhttpd
-%{_initrddir}/tclhttpd
+%{_unitdir}/tclhttpd.service
%{tcl_sitearch}/crypt1.0
%{tcl_sitearch}/limit1.0
%doc src/README
@@ -144,6 +156,9 @@ rm -rf $RPM_BUILD_ROOT
%ghost %{_var}/run/tclhttpd/tclhttpd.pid
%changelog
+* Tue Sep 20 2011 Tom Callaway <spot at fedoraproject.org> - 3.5.1-23
+- convert to systemd
+
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.5.1-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list