From e7a9a4c2fabdaf21ac0b22bc8acbc390181cc721 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 11 May 2006 13:57:06 +0000 Subject: Tweak the scripts to force bash and make dns handling in up.sh a little more robust (Portage version: 2.1_pre10-r5) --- net-misc/openvpn/files/down.sh | 2 +- net-misc/openvpn/files/up.sh | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'net-misc/openvpn') diff --git a/net-misc/openvpn/files/down.sh b/net-misc/openvpn/files/down.sh index 28ecd304ff20..98a9104e8db6 100755 --- a/net-misc/openvpn/files/down.sh +++ b/net-misc/openvpn/files/down.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) 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 -- cgit v1.2.3-65-gdbad