mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 10:51:55 +00:00
openvpn: use append for the remaining options
There is already the 'append' command, which assembles all parameters that are called 'proto_run_command'. Let´s move also the last params to the top. To ensure that the sequence is correct, the parameters must be added at the beginning, so that user parameters can overwrite them. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
committed by
Florian Eckert
parent
be20045045
commit
337a449c03
@@ -97,7 +97,7 @@ proto_openvpn_init_config() {
|
||||
|
||||
proto_openvpn_setup() {
|
||||
local config="$1"
|
||||
local exec_params
|
||||
local exec_params cd_dir
|
||||
|
||||
exec_params=
|
||||
|
||||
@@ -106,6 +106,14 @@ proto_openvpn_setup() {
|
||||
json_get_var ovpnproto ovpnproto
|
||||
[ -n "$ovpnproto" ] && append exec_params " --proto $ovpnproto"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
cd_dir="${config_file%/*}"
|
||||
[ "$cd_dir" = "$config_file" ] && cd_dir="/"
|
||||
append exec_params " --cd $cd_dir"
|
||||
append exec_params " --status /var/run/openvpn.$config.status"
|
||||
append exec_params " --syslog openvpn_$config"
|
||||
append exec_params " --tmp-dir /var/run"
|
||||
|
||||
# alllow deprecated OpenVPN configuration values by default
|
||||
json_get_var ALLOW_DEPRECATED allow_deprecated
|
||||
[ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0
|
||||
@@ -148,20 +156,11 @@ proto_openvpn_setup() {
|
||||
append exec_params " --auth-user-pass $auth_user_pass"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
cd_dir="${config_file%/*}"
|
||||
[ "$cd_dir" = "$config_file" ] && cd_dir="/"
|
||||
|
||||
# Testing option
|
||||
# ${tls_exit:+--tls-exit} \
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
proto_run_command "$config" openvpn \
|
||||
--cd "$cd_dir" \
|
||||
--status "/var/run/openvpn.$config.status" \
|
||||
--syslog "openvpn_$config" \
|
||||
--tmp-dir "/var/run" \
|
||||
$exec_params
|
||||
proto_run_command "$config" openvpn $exec_params
|
||||
|
||||
# last param wins; user provided status or syslog supersedes these.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user