Update 93-openvpn.sh

This commit is contained in:
Alexandre
2023-12-29 14:06:21 +01:00
committed by GitHub
parent 74d74014b3
commit 66581cac72

View File

@@ -29,7 +29,7 @@ if bashio::config.true 'openvpn_enabled'; then
return 1 return 1
fi fi
cp "$file" "$file2" cp "$file" /tmpfile
# Loop through each line of the input file # Loop through each line of the input file
while read line while read line
@@ -41,21 +41,20 @@ if bashio::config.true 'openvpn_enabled'; then
# Check if the txt file exists # Check if the txt file exists
if [ ! -f "$file_name" ]; then if [ ! -f "$file_name" ]; then
# Check if the txt file exists in the /config/openvpn/ directory # Check if the txt file exists in the /config/openvpn/ directory
if [ -f "/etc/openvpn/custom/${file_name##*/}" ]; then if [ -f "/config/openvpn/${file_name##*/}" ]; then
# Append /config/openvpn/ in front of the original txt file in the ovpn file # Append /config/openvpn/ in front of the original txt file in the ovpn file
sed -i "s|$file_name|/etc/openvpn/custom/${file_name##*/}|g" "$file" sed -i "s|$file_name|/config/openvpn/${file_name##*/}|g" "$file"
# Print a success message # Print a success message
bashio::log.warning "Appended /etc/openvpn/custom/ to ${file_name##*/} in $file" bashio::log.warning "Appended /config/openvpn/ to ${file_name##*/} in $file"
else else
# Print an error message # Print an error message
bashio::log.warning "$file_name is referenced in your ovpn file but does not exist in the $TRANSMISSION_HOME/openvpn folder" bashio::log.warning "$file_name is referenced in your ovpn file but does not exist, and can't be found either in the /config/openvpn/ directory"
sleep 5
fi fi
fi fi
fi fi
done < "$file2" done < /tmpfile
rm "$file2" rm /tmpfile
# Standardize lf # Standardize lf
dos2unix "$file" dos2unix "$file"