Skip to main content
Topic: Factoring out the s6 logger scripts (Read 90 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Factoring out the s6 logger scripts

Currently, most /etc/s6/sv/*-log/run files look like this copy-pasted template:

Code: [Select]
#!/bin/execlineb -P
envfile /etc/s6/config/udevd.conf
importas -sCuD "n3 s2000000 T" DIRECTIVES DIRECTIVES
ifelse { test -w /var/log } {
        foreground { install -d -o s6log -g s6log /var/log/udevd }
        s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} /var/log/udevd
}
foreground { install -d -o s6log -g s6log /run/log/udevd }
s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} /run/log/udevd

I'm pretty sure this makes it more annoying to maintain the service set, both at the distro end and for normal users who want to set up loggers for their own services.

Instead, what if something like this was /usr/bin/artix-s6-log (or /usr/lib, you name it):

Code: [Select]
#!/bin/execlineb -Ws1
envfile -I /etc/s6/config/${1}.conf
backtick -D "/run/log" %prefix { if { test -w /var/log } echo /var/log }
multisubstitute {
    # prevent serial substitution, see https://skarnet.org/lists/skaware/2041.html
    define svname $1
    importas -u prefix %prefix
    importas -sCuD "n3 s2000000 T" DIRECTIVES DIRECTIVES
}
foreground { install -d -o s6log -g s6log ${prefix}/${svname} }
s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} ${prefix}/${svname}

Then every logger service could be replaced with:

Code: [Select]
#!/bin/execlineb -P
artix-s6-log theservice

It would be far easier to tweak this template too, and these tweaks would be applied to all services, including the users' (unless they opt out by writing a custom logger service).

 

Re: Factoring out the s6 logger scripts

Reply #1
The s6 logging scripts are currently generated from a template. Your suggestion here is certainly valid though.

 
Artix forum uses a single cookie to remember youOK