From 9a31a678de5027a96e023793f1cc0f3ad41999dc Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 8 Jan 2024 22:57:33 +0100 Subject: [PATCH] Skip black auth-user-pass https://github.com/alexbelgium/hassio-addons/issues/1164 --- qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh index 34ae293e5..47df03bde 100755 --- a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh @@ -34,6 +34,18 @@ if bashio::config.true 'openvpn_enabled'; then # Loop through each line of the input file while read -r line do + # If the line contains only auth-user-pass disable it + if [[ "$line" == "auth-user-pass"* ]]; then + # Split the line by whitespace and get the second word + second_word=$(echo "$line" | awk '{print $2}') + # If the second word is empty or starts with a dash + if [ -z "$second_word" ] || [[ "$second_word" == -* ]]; then + # Comment out the line with # + sed -i '/^auth-user-pass/s/^/#/' "$file" + continue + fi + fi + # Check if the line contains a txt file if [[ ! $line =~ ^"#" ]] && [[ ! $line =~ ^";" ]] && [[ "$line" =~ \.txt ]] || [[ "$line" =~ \.crt ]] || [[ "$line" =~ auth-user-pass ]]; then # Extract the txt file name from the line