rc: run NAME_setup before RC_ARG_precmd

PR: https://forum.opnsense.org/index.php?topic=30656.0
This commit is contained in:
Franco Fichtner 2022-10-17 14:23:56 +02:00
parent a72dccaa7d
commit ca9cdd508e

View file

@ -1042,12 +1042,12 @@ run_rc_command()
if [ -n "$_env" ]; then
eval "export -- $_env"
fi
_run_rc_precmd || return 1
# service can redefine all so check for valid targets
if [ "$rc_arg" = 'start' -o "$rc_arg" = 'restart' -o \
"$rc_arg" = 'reload' ]; then
_run_rc_setup || warn "failed to setup ${name}"
fi
_run_rc_precmd || return 1
_run_rc_doit "$_cmd $rc_extra_args" || return 1
_run_rc_postcmd
return $_return
@ -1107,13 +1107,15 @@ run_rc_command()
return 1
fi
_run_rc_setup || warn "failed to setup ${name}"
if ! _run_rc_precmd; then
warn "failed precmd routine for ${name}"
return 1
fi
# setup the full command to run
#
# setup the full command to run
#
check_startmsgs && echo "Starting ${name}."
if [ -n "$_chroot" ]; then
_cd=
@ -1143,8 +1145,6 @@ $command $rc_flags $command_args"
fi
fi
_run_rc_setup || warn "failed to setup ${name}"
# Prepend default limits
_doit="$_cd limits -C $_login_class $_limits $_doit"
@ -1188,10 +1188,10 @@ $command $rc_flags $command_args"
return 1
fi
_run_rc_precmd || return 1
_run_rc_setup || warn "failed to setup ${name}"
_run_rc_precmd || return 1
_doit=$(_run_rc_killcmd "${sig_reload:-HUP}")
_run_rc_doit "$_doit" || return 1