[packages/taskserver] package systemd unit; rel 3

atler atler at pld-linux.org
Mon Dec 14 19:54:22 CET 2020


commit deb42bc113f62aec531b766e6435bca11dd85779
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Dec 14 19:53:32 2020 +0100

    package systemd unit; rel 3

 taskserver.spec | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/taskserver.spec b/taskserver.spec
index 9b6cb17..0d333b8 100644
--- a/taskserver.spec
+++ b/taskserver.spec
@@ -1,8 +1,12 @@
+#
+# Conditional build:
+%bcond_without	systemd		# without systemd unit
+
 %define		shortname	taskd
 Summary:	Taskserver is a sync server for Taskwarrior and related products
 Name:		taskserver
 Version:	1.1.0
-Release:	2
+Release:	3
 License:	MIT
 Group:		Applications
 Source0:	http://www.taskwarrior.org/download/%{shortname}-%{version}.tar.gz
@@ -14,6 +18,9 @@ BuildRequires:	libstdc++-devel
 BuildRequires:	libuuid-devel
 BuildRequires:	pkgconfig
 BuildRequires:	rpmbuild(macros) >= 1.605
+%{?with_systemd:Requires:	systemd-units >= 38}
+Provides:	group(taskd)
+Provides:	user(taskd)
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -28,14 +35,38 @@ Taskserver is a sync server for Taskwarrior and related products.
 %install
 rm -rf $RPM_BUILD_ROOT
 
+install -d $RPM_BUILD_ROOT/var/lib/taskd
+
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%if %{with systemd}
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+cp -p scripts/systemd/taskd.service $RPM_BUILD_ROOT%{systemdunitdir}
+%endif
+
 %{__rm} -rf $RPM_BUILD_ROOT%{_docdir}/%{shortname}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+%groupadd -g 340 taskd
+%useradd -u 340 -r -d /var/lib/taskd -s /bin/false -c "Task Server user" -g taskd taskd
+
+%post
+%{?with_systemd:%systemd_post taskd.service}
+
+%preun
+%{?with_systemd:%systemd_preun taskd.service}
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove taskd
+	%groupremove taskd
+fi
+%{?with_systemd:%systemd_reload}
+
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog NEWS README
@@ -44,3 +75,5 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/%{shortname}.1*
 %{_mandir}/man1/taskdctl.1*
 %{_mandir}/man5/taskdrc.5*
+%{?with_systemd:%{systemdunitdir}/taskd.service}
+%dir %attr(750,taskd,taskd) /var/lib/taskd
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/taskserver.git/commitdiff/deb42bc113f62aec531b766e6435bca11dd85779



More information about the pld-cvs-commit mailing list