--- a/rpm/upmpdcli.spec
+++ b/rpm/upmpdcli.spec
@@ -1,13 +1,18 @@
Summary: UPnP Media Renderer front-end to MPD, the Music Player Daemon
Name: upmpdcli
-Version: 0.5
+Version: 0.6.1
Release: 1%{?dist}
Group: Applications/Multimedia
License: GPLv2+
URL: http://www.lesbonscomptes.com/updmpdcli
Source0: http://www.lesbonscomptes.com/upmpdcli/downloads/upmpdcli-%{version}.tar.gz
+Requires(pre): shadow-utils
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
BuildRequires: libupnp-devel
BuildRequires: libmpdclient-devel
+BuildRequires: systemd-units
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
@@ -15,21 +20,29 @@
usable with most UPnP Control Point applications, such as those which run
on Android tablets or phones.
+
%prep
%setup -q
%build
%configure
%{__make} %{?_smp_mflags}
-%{__rm} -f %{buildroot}%{_libdir}/libupnpp.a
-%{__rm} -f %{buildroot}%{_libdir}/libupnpp.la
+
+%pre
+getent group upmpdcli >/dev/null || groupadd -r upmpdcli
+getent passwd upmpdcli >/dev/null || \
+ useradd -r -g upmpdcli -d /nonexistent -s /sbin/nologin \
+ -c "upmpdcli mpd UPnP front-end" upmpdcli
+exit 0
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot} STRIP=/bin/true INSTALL='install -p'
%{__rm} -f %{buildroot}%{_libdir}/libupnpp.a
%{__rm} -f %{buildroot}%{_libdir}/libupnpp.la
-%{__rm} -f %{buildroot}/etc/upmpdcli.conf
+install -D -m644 systemd/upmpdcli.service \
+ %{buildroot}%{_unitdir}/upmpdcli.service
+
%clean
%{__rm} -rf %{buildroot}
@@ -40,10 +53,22 @@
%{_libdir}/libupnpp-%{version}.so*
%{_libdir}/libupnpp.so
%{_datadir}/%{name}
-#%{_datadir}/%{name}/*
%{_mandir}/man1/%{name}.1*
+%{_unitdir}/upmpdcli.service
+%config(noreplace) /etc/upmpdcli.conf
+
+%post
+%systemd_post upmpdcli.service
+
+%preun
+%systemd_preun upmpdcli.service
+
+%postun
+%systemd_postun_with_restart upmpdcli.service
%changelog
+* Wed Feb 26 2014 J.F. Dockes <jf@dockes.org> - 0.6.1
+- Version 0.6.1
* Thu Feb 13 2014 J.F. Dockes <jf@dockes.org> - 0.5
- Version 0.5
* Wed Feb 12 2014 J.F. Dockes <jf@dockes.org> - 0.4