Mail archive
alpine-aports

[alpine-aports] [PATCH] main/openvpn: fix down script not restoring original resolv.conf

From: Chris Kankiewicz <chris_at_chriskankiewicz.com>
Date: Wed, 20 Jan 2016 14:16:58 -0700

This patch fixes an error where, in the provided OpenVPN down script, the
cp command would fail due to the resolv.conf file already existing.

Instead of using cp we cat the file contents over the exising resolv.conf
file to avoid the error and preserve any symlinks that may exist.

Fixes issue #5027
---
 main/openvpn/openvpn.down | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/main/openvpn/openvpn.down b/main/openvpn/openvpn.down
index 1c70db0..ad8910e 100644
--- a/main/openvpn/openvpn.down
+++ b/main/openvpn/openvpn.down
_at_@ -13,9 +13,9 @@ if [ "${PEER_DNS}" != "no" ]; then
 	if [ -x /sbin/resolvconf ] ; then
 		/sbin/resolvconf -d "${dev}"
 	elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then
-		# Important that we copy instead of move incase resolv.conf is
+		# Important that we cat instead of move incase resolv.conf is
 		# a symlink and not an actual file
-		cp /etc/resolv.conf-"${dev}".sv /etc/resolv.conf
+		cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf
 		rm -f /etc/resolv.conf-"${dev}".sv
 	fi
 fi
-- 
2.5.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Jan 20 2016 - 14:16:58 GMT