A mix of s6-envdir and importas. Reads files containing variable assignments in the given directory, adds the variables to the environment and then executes a program.
execl-envfile [ -h ] [ -f file ] [ -l ] dir prog
This tool expects to find one or more regular file(s) in dir containing one or multiple key=value pair(s). For earch file found it will parse that file, import the key=value and then exec the given prog with the modified environment.
file is a text file containing lines of pairs with the syntax being:
key = value
Whitespace is permitted before and after key, and before or after value. Quoting is also possible.
Empty lines or lines containing only whitespace are ignored. Lines beginning with # (also after whitespace) are ignored and typically used for comments. Comments are not possible at the end of lines: 'key = value # comment' is not a valid comment.
Empty values are not permitted.
If key begin by a '!' character: !key=value the key will be removed from the environment after the substitution.
#!/usr/bin/execlineb -P fdmove -c 2 1 execl-envfile -f ntpd /etc/66/conf/ foreground { mkdir -p -m 0755 ${RUNDIR} } execl-cmdline -s { ntpd ${CMD_ARGS} }
The equivalent with s6-envdir and importas would be:
#!/usr/bin/execlineb -P fdmove -c 2 1 s6-envdir /etc/66/conf importas -u RUNDIR RUNDIR importas -u CMD_ARGS CMD_ARGS foreground { mkdir -p -m 0755 ${RUNDIR} } execl-cmdline -s { ntpd ${CMD_ARGS} }
where /etc/66/conf contains two named files RUNDIR and CMD_ARGS written with /run/openntpd and -d -s respectively.
dir can not exceed more than 100 files. Each file can not contain more than 4095 bytes or more than 50 key=value pairs.