On Thu, Nov 3, 2016 at 11:49 AM, arnaud gaboury <arnaud.gaboury@gmail.com> wrote:


On Thu, Nov 3, 2016 at 1:47 PM Richard Shaw <hobbes1069@gmail.com> wrote:
On Thu, Nov 3, 2016 at 6:42 AM, arnaud gaboury <arnaud.gaboury@gmail.com> wrote:
Below is part of my .spec file:
--------------------------------------------------

%install
install -Dm644 mattermost.service %{buildroot}/usr/lib/systemd/system/mattermost.service
install -Dm644 mattermost-user.conf %{buildroot}/usr/lib/sysusers.d/mattermost.conf

First install line change to %{buildroot}%{_unitdir} for the systemd file
and the second to use %{buildroot}%{_sysusersdir} for the conf file.

Also, be consistent, use the macros both in %install and in %files.

Do you mean this ? :

--------------------------------------------------
 %install
install -Dm644 mattermost.service %{buildroot}%{_unitdir}/system/mattermost.service
install -Dm644 mattermost-user.conf %{buildroot}%{_sysuserdir}/mattermost.conf

%files
%{_unitdir}/system/mattermost.service
%{_sysuserdir}/mattermost.conf
------------------------------------------------------------------

Almost, you can test the macro definitions like so:

$ rpm -E %_unitdir
/usr/lib/systemd/system 
$ rpm -E %_sysusersdir
/usr/lib/sysusers.d

So no need to add "system" to the directory.


Where do these macro come from ? Any doc link ?

I'm pretty sure the systemd one comes with the systemd package, not sure about sysusersdir. I've never needed that one before I only found it like this:

$ rpm --showrc | grep sysuser
-14: _sysusersdir       /usr/lib/sysusers.d
-14: sysusers_create
systemd-sysusers %{?*} >/dev/null 2>&1 || :
-14: sysusers_create_inline
echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || :

Thanks,
Richard