summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/openvpn/files/up.sh')
-rwxr-xr-xnet-misc/openvpn/files/up.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/net-misc/openvpn/files/up.sh b/net-misc/openvpn/files/up.sh
index b67d3266556e..7e6c0719d4aa 100755
--- a/net-misc/openvpn/files/up.sh
+++ b/net-misc/openvpn/files/up.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright (c) 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -11,18 +11,17 @@
# 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;
+DNS="$(set | sed -n "s/^foreign_option_.* DNS \(.*\)'/nameserver \1/; T next; p;
:next; s/^foreign_option_.* DOMAIN \(.*\)'/domain \1/; T; p;")"
if [[ -n ${DNS} ]] ; then
DNS="# Generated by openvpn for interface ${dev}\n${DNS}"
-fi
-
-if [[ -x /sbin/resolvconf ]] ; then
- echo -e "${DNS}" | /sbin/resolvconf -a "${dev}"
-elif [[ -n ${DNS} ]] ; then
- echo -e "${DNS}" > /etc/resolv.conf
- chmod 644 /etc/resolv.conf
+ if [[ -x /sbin/resolvconf ]] ; then
+ echo -e "${DNS}" | /sbin/resolvconf -a "${dev}"
+ else
+ echo -e "${DNS}" > /etc/resolv.conf
+ chmod 644 /etc/resolv.conf
+ fi
fi
# If we have a service specific script, run this now