troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
634 stars 64 forks source link

service environment variables are not expanded when sourced #377

Closed az143 closed 1 year ago

az143 commented 1 year ago

when setting up an /etc/default/somesvc, it is currently not possible to reference variables defined earlier, because source_env() only strips undesirable bits before calling setenv().

for example, this construction doesn't work:

RUNDIR=/var/run/somesvc
DAEMON_ARGS=--workdir $RUNDIR --other-args...

i think that running wordexp() before the setenv() calls would remove this limitation; if that's not true, then the limitation should be mentioned in doc/config.md and man/finit.conf.5.

az143 commented 1 year ago

see pr #379

troglobit commented 1 year ago

A wordexp() of the value (in key=value) is probably the way to go here. It fits with the principle of least surprise, does not leak to other processes, and would also keep the documentation to a minimum.