66
www.obarun.org

execl-envfile

This command is a blend of s6-envdir and importas program. It reads files containing variable assignments on the given directory, adds the variables to the environment, then executes a program.

Interface

	execl-envfile [ -h ] [ -l ] src prog
	

This tool expects to find a regular file(s) or directory as src containing one or multiple key=value pair. For each files found: it will parse the file, import the key=value then execs prog with the modified environment.

In case as src is a directory, the same processus is made for each files found in src. src can be absolute or relative path. In case of relative path only '../','./', '.' or '..' are accepted as valid format.

Options

File syntax

file is a text file containing lines of the form key=value. Whitespace is permitted before and after key, and before or after value, Quoting is also possible. In this case, the quoting field is treated as one word.

Empty lines, or lines containing only whitespace, are ignored. Lines beginning with # (possibly after some 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 value is not permitted.

If key begin by a '!' character: !key=value the key will be removed from the environment after the substitution.

If the same key=value pair is found multiple time, only the first one definition is keepts.

It must be terminated by an empty new line.

Example of use

	#!/usr/bin/execlineb -P
	fdmove -c 2 1
	execl-envfile /etc/66/conf/ntpd
	foreground { mkdir -p  -m 0755 ${RUNDIR} } 
	execl-cmdline -s { ntpd ${CMD_ARGS} }
	

The strict equivalent with s6-envdir and importas command will 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 directory contains two named files RUNDIR and CMD_ARGS written with /run/openntpd and -d -s respectively.

limits

src cannot exceed more than 100 files. Each file cannot contain more than 4095 bytes or more than 50 key=value pairs.