From: Paul Sopka <psopka@sopka.ch>
To: supervision@list.skarnet.org, janbraun@gmx.de
Subject: Re: s6/s6-rc policy for Gentoo: config files for service scripts
Date: Thu, 19 Sep 2024 16:40:34 +0200 [thread overview]
Message-ID: <b1007b96-5419-47d6-bde0-27b6d3732eb0@sopka.ch> (raw)
In-Reply-To: <ZuubfBIDY8YNviIZ@abakus>
[-- Attachment #1.1.1: Type: text/plain, Size: 3280 bytes --]
> A skeleton is not config data, and should thus be in /usr/
> Possibly /usr/.../examples/...
I agree, the reason i put it there ist that /etc/s6-linux-init/skel/
exists (at least on Gentoo Linux), thus for consistency.
>> - The package manager puts service source directories and an initial
>> set of bundles for system services to
>> /etc/s6-rc/system/src/{services,bundles}.
>>
>> - The package manager puts service source directories and an initial
>> set of bundles for both user and system services to
>> /usr/share/s6-rc/{user,system} as a reference of the defaults.
> If you put defaults in /usr, then prefer symlinking them into /etc,
> rather than creating a copy. That'll automatically handle changing
> defaults, and make it obvious what is locally customized.
I am not sure if I understand correctly, the files under
/usr/share/s6-rc/{user,system}
are to be there only as a reference, not to be edited.
Are you trying to say that the non-edited files should be symlinked
rather than copied?
> Void has a nice idiom in their run scripts:
>
> | #!/bin/sh
> | exec 2>&1
> | [ -r conf ] && . ./conf
> | exec acpid -f ${OPTS:=-l}
>
> That achieves 3 things:
> 1) It works out of the box (without a conf file).
> 2) The user can create a conf file containing
> OPTS='-l -d -S'
> to customize the daemon options.
> 3) The user can create a conf file containing
> if [ $((`date +%s` % 100)) -eq 0 ] ; then poweroff ; fi
> exec /usr/local/bin/notreallyacpid --foo
> to completely¹ override the run file.
>
> Note how the KEY=value pair in 2) is actually shell, hopefully
> eliminating any worries about config file format.
>
> HTH,
> Jan
>
> ¹)
> The "exec 2>&1" is an artifact of how runit does logging, and should
> always be done. Hence it comes before the conf entry point. If there was
> a valid use for stderr, lines 2 and 3 could be switched, of course.
Glorious.
Although it has to be done a bit differently when using execline (which
I intend to use):
Take my current version of the seatd-srv:
| #!/bin/execlineb -P
|
| fdmove -c 2 1
|
| multisubstitute
| {
| define SRV seatd
| importas -SD /etc/s6-rc S6CONFIGDIR
| }
|
| envfile -I ${S6CONFIGDIR}/system/config/${SRV}.conf
|
| multisubstitute
| {
| importas -SD "root" SEATD_USER
| importas -SD "seat" SEATD_GROUP
| importas -SD "seatd" SRV_EXEC
| importas -sSD "" SRV_OPTS
| }
|
|
| ${SRV_EXEC} -n3
| -u ${SEATD_USER}
| -g ${SEATD_GROUP}
| ${SRV_OPTS}
Would turn into:
| #!/bin/execlineb -P
|
| fdmove -c 2 1
|
| importas -SD /etc/s6-rc S6CONFIGDIR
|
| tryexec ${S6CONFIGDIR}/system/config/seatd
|
| seatd -n3 -u root -g seatd
Allowing the sysadmin to completely override the service.
Unfortunately this also forces the sysadmin to override the service for
every so little change,
so your
> 2) The user can create a conf file containing
> OPTS='-l -d -S'
> to customize the daemon options.
wont work anymore but I do not see how one could work around this in
execline.
What do you think?
Regards,
Paul
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2024-09-19 14:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 19:43 Paul Sopka
2024-09-19 3:33 ` Jan Braun
2024-09-19 14:40 ` Paul Sopka [this message]
2024-09-19 17:51 ` Jan Braun
2024-09-19 18:28 ` Hoël Bézier
2024-09-19 19:11 ` Paul Sopka
2024-09-19 20:26 ` Jan Braun
2024-09-20 10:19 ` Paul Sopka
2024-09-20 11:10 ` Jan Braun
2024-09-19 19:07 ` Paul Sopka
2024-09-19 20:47 ` Re[2]: " Laurent Bercot
2024-09-20 10:21 ` Paul Sopka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b1007b96-5419-47d6-bde0-27b6d3732eb0@sopka.ch \
--to=psopka@sopka.ch \
--cc=janbraun@gmx.de \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).