[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: init system policy


[ redirecting to debian-devel, as -policy isn't the correct list for this IMHO ]

Eric Valette:
> <html>

Text emails, please.

>     I've been fighting with some script conversion to systemd and I think
>     a reasonnably complex exemple should be of great help. I've been

What's "reasonably complex" to you is "absurdly simple" to one reader and
"needlessly arcane" to somebody else. :-/

>     trying to convert minidlna sysv init file to systemd, managed to have
>     a working unit file but failed to split the configuration mimicing
>     the ../default/minidlna content with the hability to make USER and
>     GROUP configurable.

You _can_ do

>     ExecStart=sudo -u $USER_MINIDLNA -g GROUP_MINIDLNA /usr/sbin/minidlnad -S

but that's not the optimal solution here.

It's better IMHO to use a fixed user in your packaging -- why should that
user be configurable in the first place? If the sysadmin _really_ needs to
use a different user+group, they can add an overriding unit file to
/etc/systemd/system/ (files get merged, so no need to copy the whole thing).

>     ExecStartPre=/bin/mkdir -p /var/run/minidlna

You might want to use this opportunity to replace /var/run with /run.

>     ExecStartPre=/bin/chown $USER /var/run/minidlna

You should use "%u"; see systemd.unit(5).

Also, one ExecStartPre stanza is sufficient:

>	ExecStartPre=/usr/bin/install -o %u -g %g -m 0750 -d /run/minidlna

(or whichever mode is appropriate)

-- Matthias Urlichs

Attachment: signature.asc
Description: Digital signature

Reply to: