diff options
author | Mateusz Piotrowski <0mp@FreeBSD.org> | 2019-09-05 14:52:22 +0000 |
---|---|---|
committer | Mateusz Piotrowski <0mp@FreeBSD.org> | 2019-09-05 14:52:22 +0000 |
commit | d15e810db9a57833272cceffa41998575360cb0c (patch) | |
tree | 66256618f29a7c8b41e9d5d0d5b5dcf31de28e34 /libexec | |
parent | 92fd0827c16e521afb026c0290ab30884fb496a4 (diff) | |
download | src-d15e810db9a57833272cceffa41998575360cb0c.tar.gz src-d15e810db9a57833272cceffa41998575360cb0c.zip |
rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)
A user may set ${name}_env variable in rc.conf(5) in order to set additional
environment variables for a service command. Unfortunately, at the moment
this variable is only honored when the command is specified via the command
variable. Those additional environment variables coming from ${name}_env
are never set if the service is started via the ${rc_arg}_cmd variable (for
example start_cmd).
PR: 239692
Reviewed by: bcr, jilles
Approved by: src (jilles)
Differential Revision: https://reviews.freebsd.org/D21228
Notes
Notes:
svn path=/head/; revision=351863
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rc/rc.subr | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 93d2cfda87b7..4ae3c7ec1084 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1036,6 +1036,9 @@ run_rc_command() _postcmd=\$${rc_arg}_postcmd if [ -n "$_cmd" ]; then + if [ -n "$_env" ]; then + eval "export -- $_env" + fi _run_rc_precmd || return 1 _run_rc_doit "$_cmd $rc_extra_args" || return 1 _run_rc_postcmd |