diff options
author | Roy Marples <uberlord@gentoo.org> | 2006-09-12 23:50:11 +0000 |
---|---|---|
committer | Roy Marples <uberlord@gentoo.org> | 2006-09-12 23:50:11 +0000 |
commit | 63d5e80a8032ef6120c96e25748d6e9b0be70200 (patch) | |
tree | a9feecea4398fa9454f108ac6041eb0ba7fafd72 /net-misc/openvpn/files/up.sh | |
parent | mark stable (diff) | |
download | historical-63d5e80a8032ef6120c96e25748d6e9b0be70200.tar.gz historical-63d5e80a8032ef6120c96e25748d6e9b0be70200.tar.bz2 historical-63d5e80a8032ef6120c96e25748d6e9b0be70200.zip |
Version bump, #147308 thanks to Alon Bar-Lev.
Package-Manager: portage-2.1.1
Diffstat (limited to 'net-misc/openvpn/files/up.sh')
-rwxr-xr-x | net-misc/openvpn/files/up.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net-misc/openvpn/files/up.sh b/net-misc/openvpn/files/up.sh index f950577532b7..0a18876aae93 100755 --- a/net-misc/openvpn/files/up.sh +++ b/net-misc/openvpn/files/up.sh @@ -11,11 +11,19 @@ # and will use the first one that responds - maybe the LAN ones? # non resolvconf users just the the VPN resolv.conf -DNS="$(set | sed -n "s/^foreign_option_.* DNS \(.*\)'/nameserver \1/; T next; p; - :next; s/^foreign_option_.* DOMAIN \(.*\)'/domain \1/; T; p;")" +NS= +DOMAIN= +for var in ${!foreign_option_*} ; do + opt="${!var}" + if [[ ${opt} =~ "dhcp-option DOMAIN (.*)" ]] ; then + DOMAIN="${DNS}domain ${BASH_REMATCH[1]}\n" + elif [[ ${opt} =~ "dhcp-option DNS (.*)" ]] ; then + NS="${DNS}nameserver ${BASH_REMATCH[1]}\n" + fi +done -if [[ -n ${DNS} ]] ; then - DNS="# Generated by openvpn for interface ${dev}\n${DNS}" +if [[ -n ${NS} ]] ; then + DNS="# Generated by openvpn for interface ${dev}\n${DOMAIN}${NS}" if [[ -x /sbin/resolvconf ]] ; then echo -e "${DNS}" | /sbin/resolvconf -a "${dev}" else |