Re: s6/s6-rc policy for Gentoo: config files for service scripts
Jan Braun <[email protected]> Thu, 19 Sep 2024 05:33:16 +0200
| Newsgroups | gmane.comp.sysutils.supervision.general |
|---|---|
| Message-ID | <ZuubfBIDY8YNviIZ@abakus> |
Paul Sopka schrob:
> - The sysadmin or the user can copy a skeleton from
> /etc/s6-rc/skel/{config,src} (which is populated by the package
> manager with configs and initial bundles) to ${HOME}/.config/s6-rc/,
> this folder shall be used for configuration and custom user services.
A skeleton is not config data, and should thus be in /usr/
Possibly /usr/.../examples/...
> - 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.
> - The idea of config files is completely dropped and the "editing the
> config" part is shifted to "editing the run-script"
> [...]
> Do you suggest any alterations or even a completely different approach?
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.
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFzbVDxcLcKaSI7wVKV5wPm0dL88FAmbrm3YACgkQKV5wPm0d L8/6Hw/5AQ7IGiCQHQw2wHCV+yqYW78RpBso5ZSzk4QZAoIE95xlqnEDsRCE0V+k E42V2So3nEIbqax3xmS/9QmdE+qGjde6Z0TUo/s8DzXDQxQZlfA+qA5gPpeheA6W YAHXMKH4igDjfNp88imselHcBTUXRao5zEg6PzGSGXXm5d26DoKMdHQk1V9gcly2 7ClTa1fac0UFUeWFmdttQ17Bd1MaYAQ30GuM4/Ma59xXTu6ytbPzgaZqe1ZKVcRu rJe/yiYkZDQh8m+kRFWq1xX9KPXpZ3uuTOFmoGmNAruvo4I5DhrwPoNgY2i0NM8/ MVv1526AOjwySKLIYWQsKoX/SZVHyuAz7FBEVW9dHCgqmRFXQNivVFI8wCEXv1LB yLfDmNEdOz/DDmAeUmOdibBWtOgAD4eHEOtJ2DokkxSXF9+cfwEyah8+aCVA8Qch lPyT5hc8HW/oIR0dkmF5IpuRGz9YwWsDUbrBrqeEmQxDmowOW4Rf2UatLCiNSwB7 zQ96e97k/odh37PPM7KpKDxl2+K3idCt/KH5uw1w0Cjk4rnhY1r14M+Q9KExWIKS 9KPS14XAK4sTDHK4Zp1lzwecRhDKYI3MQxZCwtv4pMKKLs4WKrYMVLV3wBiVBCWj 7/v/2k5TY0YgINluaIjmJcU9ZpPTjJmCs1TQBXCo7GDUCkVaDGg= =0L5l -----END PGP SIGNATURE-----