1#! /bin/sh
2# -*- shell-script -*-
3
4# Shell script to be called from radns. This will call the resolvconf
5# program which will merge the DNS addresses into the real
6# /etc/resolv.conf.
7
8PATH=$PATH:/usr/local/sbin
9export PATH
10
11# For debug
12#echo interface: $if
13#echo resolv_conf: $resolv_conf
14
15if [ "$if" = "" ]
16then
17    exit 1;
18fi
19
20if [ "$resolv_conf" = "" ]
21then
22    if [ $verbose -gt 0 ]
23    then
24        echo "$0: Environment variable $resolv_conf not set. Exiting..."
25    fi
26    exit 1
27fi
28
29# Do nothing if $resolv_conf is not an ordinary file
30if [ ! -f $resolv_conf ]
31then
32    if [ $verbose -gt 0 ]
33    then
34        echo "$0: $resolv_conf is not an ordinary file or does not exist. Exiting..."
35    fi
36    exit 1
37fi
38
39# resolvconf's interface directory
40# (/usr/local/etc/resolvconf/run/interfaces/ on FreeBSD) needs to be
41# writable by our user, by default 'radns'.
42
43resolvconf -a $if < $resolv_conf
44