[yaws/epel7] sysvinit -> systemd
Lubomir Rintel
lkundrak at fedoraproject.org
Fri Feb 21 14:39:10 UTC 2014
commit 4bfe405f8540f5da8cd4069f4de3803f3c4be116
Author: Lubomir Rintel <lkundrak at v3.sk>
Date: Fri Feb 21 13:48:50 2014 +0100
sysvinit -> systemd
yaws-1.92-sysvinit.patch | 52 ----------------------------------------------
yaws.service | 17 +++++++++++++++
yaws.spec | 34 ++++++++++++++++--------------
3 files changed, 35 insertions(+), 68 deletions(-)
---
diff --git a/yaws.service b/yaws.service
new file mode 100644
index 0000000..baa0e5f
--- /dev/null
+++ b/yaws.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=The Yaws Web Server instance
+After=network.target
+
+[Service]
+User=root
+Type=notify
+Environment="HOME=/var/lib/yaws"
+# We need to use --daemon and Type=forking, otherwise it would spawn the
+# Erlang shell that terminates upon attempt to read from /dev/null input :(
+Type=forking
+ExecStart=/usr/bin/yaws --daemon --conf /etc/yaws/%i.conf
+ExecReload=/usr/bin/echo /usr/bin/yaws --hup --conf /etc/yaws/%i.conf
+ExecStop=/usr/bin/echo /usr/bin/yaws --stop --conf /etc/yaws/%i.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/yaws.spec b/yaws.spec
index 64447e7..157134a 100644
--- a/yaws.spec
+++ b/yaws.spec
@@ -2,7 +2,7 @@
Name: yaws
Version: 1.98
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Web server for dynamic content written in Erlang
Group: System Environment/Daemons
# BSD: see LICENSE
@@ -14,11 +14,12 @@ License: BSD and ERPL and Copyright only and W3C
URL: http://yaws.hyber.org/
Source0: http://yaws.hyber.org/download/%{name}-%{version}.tar.gz
Source1: yaws.logrotate
-Patch0: yaws-1.92-sysvinit.patch
+Source2: yaws.service
Patch1: yaws-1.98-fhs.patch
Patch2: yaws-1.98-conf.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+BuildRequires: systemd-units
BuildRequires: erlang-erts
BuildRequires: erlang-erlsom
BuildRequires: erlang-kernel
@@ -39,8 +40,9 @@ Requires: erlang-erlsom
Requires: erlang-ibrowse
Requires: erlang-xmlrpc
Requires: logrotate
-Requires(post): chkconfig
-Requires(preun): chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
@@ -65,7 +67,6 @@ This package contains a pkg-config configuration for %{name}.
%prep
%setup -q
-%patch0 -p1 -b .sysvinit
%patch1 -p1 -b .fhs
%patch2 -p1 -b .conf
@@ -104,33 +105,31 @@ rmdir $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -p -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/yaws
+# The systemd bits
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}
+
%clean
rm -rf $RPM_BUILD_ROOT
%post
-/sbin/chkconfig --add yaws
+%systemd_post yaws.service
%preun
-if [ $1 = 0 ]
-then
- /sbin/service yaws stop >/dev/null 2>&1
- /sbin/chkconfig --del yaws
-fi
+%systemd_preun yaws.service
%postun
-if [ $1 -ge 1 ]
-then
- /sbin/service yaws condrestart >/dev/null 2>&1 || :
-fi
+%systemd_postun
%files
%defattr(-,root,root,-)
-%{_initrddir}/yaws
+%exclude %{_initrddir}/yaws
+%{_unitdir}/yaws.service
%dir %{_sysconfdir}/yaws
%config(noreplace) %{_sysconfdir}/yaws/yaws.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/yaws
@@ -153,6 +152,9 @@ fi
%changelog
+* Fri Feb 21 2014 Lubomir Rintel (GoodData) <lkundrak at v3.sk> - 1.98-2
+- sysvinit -> systemd
+
* Thu Feb 13 2014 Lubomir Rintel (GoodData) <lkundrak at v3.sk> - 1.98-1
- Rebase
More information about the scm-commits
mailing list