YunoHost-Apps / vpnclient_ynh

VPN Client app for YunoHost
GNU Affero General Public License v3.0
41 stars 25 forks source link

Broken install when using .cube with openvpn_rm #83

Closed fluboi closed 2 years ago

fluboi commented 2 years ago

When using a .cube with some line in openvpn_rm section (to remove unneeded openvpn config lines from the default template), the install fails on a sed error.

To reproduce: add an openvpn_rm section to your .cube and try to install it.

[...]
  "openvpn_rm": [
    "comp-lzo adaptive"
  ],
[...]

Result:

2021-11-07 21:06:31,025: DEBUG - + cp -f /etc/openvpn/client.conf.tpl /tmp/ynh_filequestion_97k9q773/client.conf.tpl
2021-11-07 21:06:31,026: DEBUG - ++ jq --raw-output '.openvpn_rm[]' /tmp/ynh_filequestion_97k9q773/tmp14rkurw0
2021-11-07 21:06:31,031: DEBUG - + for rm_regex in "$(jq --raw-output '.openvpn_rm[]' "${config_file}")"
2021-11-07 21:06:31,031: DEBUG - + '[' '!' -z 'comp-lzo adaptive' ']'
2021-11-07 21:06:31,031: DEBUG - + sed -i '/comp-lzo adaptive/di' /tmp/ynh_filequestion_97k9q773/client.conf.tpl
2021-11-07 21:06:31,033: WARNING - sed: -e expression n°1, caractère 21: caractères inutiles après la commande
2021-11-07 21:06:31,033: DEBUG - + ynh_exit_properly

It seems to be a typo in the config script: https://github.com/YunoHost-Apps/vpnclient_ynh/blob/testing/scripts/config#L250

We probably need to remove the ending "i" sed -i "/$rm_regex/d" $tmp_dir/client.conf.tpl

zamentur commented 2 years ago

https://github.com/YunoHost-Apps/vpnclient_ynh/commit/7adf77043a2debe5704aae194d77929982430eca should fix the issue