mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-18 10:42:11 +01:00
Merge pull request #2584 from alexbelgium/copilot/fix-openvpn-startup-issue
Fix Transmission OpenVPN startup failure caused by systemd-resolved in containers
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
|
||||
## v5.4.0-2 (2026-03-16)
|
||||
|
||||
- Fix: Replace update-resolv-conf script that uses systemd-resolved (unavailable in containers) with one that directly updates /etc/resolv.conf
|
||||
|
||||
## v5.4.0 (2026-03-14)
|
||||
- Update to latest version from haugene/docker-transmission-openvpn (changelog : https://github.com/haugene/docker-transmission-openvpn/releases)
|
||||
- The Home Assistant project has deprecated support for the armv7, armhf and i386 architectures. Support wil be fully dropped in the upcoming Home Assistant 2025.12 release
|
||||
|
||||
@@ -138,4 +138,4 @@ schema:
|
||||
slug: transmission_openvpn
|
||||
udev: true
|
||||
url: https://github.com/alexbelgium/hassio-addons
|
||||
version: "v5.4.0"
|
||||
version: "v5.4.0-2"
|
||||
|
||||
57
transmission_openvpn/rootfs/etc/openvpn/update-resolv-conf
Executable file
57
transmission_openvpn/rootfs/etc/openvpn/update-resolv-conf
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# OpenVPN update-resolv-conf replacement for containerized environments
|
||||
# The default script from the base image uses systemd-resolved via D-Bus,
|
||||
# which is unavailable in Home Assistant add-on containers.
|
||||
# This script directly updates /etc/resolv.conf instead.
|
||||
|
||||
[ "$script_type" ] || exit 0
|
||||
|
||||
case "$script_type" in
|
||||
up)
|
||||
# Backup original resolv.conf
|
||||
if [ ! -f /etc/resolv.conf.ovpn-bak ]; then
|
||||
cp /etc/resolv.conf /etc/resolv.conf.ovpn-bak 2>/dev/null || true
|
||||
fi
|
||||
|
||||
dns_servers=""
|
||||
dns_domain=""
|
||||
dns_search=""
|
||||
|
||||
# Parse foreign_option_* environment variables set by OpenVPN
|
||||
for optionname in ${!foreign_option_*}; do
|
||||
option="${!optionname}"
|
||||
case "$option" in
|
||||
dhcp-option\ DNS\ *)
|
||||
dns_servers="${dns_servers} ${option#dhcp-option DNS }"
|
||||
;;
|
||||
dhcp-option\ DOMAIN\ *)
|
||||
dns_domain="${option#dhcp-option DOMAIN }"
|
||||
;;
|
||||
dhcp-option\ DOMAIN-SEARCH\ *)
|
||||
dns_search="${dns_search} ${option#dhcp-option DOMAIN-SEARCH }"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Write new resolv.conf with VPN DNS servers
|
||||
if [ -n "$dns_servers" ]; then
|
||||
{
|
||||
for server in $dns_servers; do
|
||||
echo "nameserver $server"
|
||||
done
|
||||
[ -n "$dns_domain" ] && echo "domain $dns_domain"
|
||||
[ -n "$dns_search" ] && echo "search${dns_search}"
|
||||
} > /etc/resolv.conf
|
||||
fi
|
||||
;;
|
||||
|
||||
down)
|
||||
# Restore original resolv.conf
|
||||
if [ -f /etc/resolv.conf.ovpn-bak ]; then
|
||||
cp /etc/resolv.conf.ovpn-bak /etc/resolv.conf
|
||||
rm -f /etc/resolv.conf.ovpn-bak
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user