~cyphermox/ubuntu/precise/dnsmasq/dbus

« back to all changes in this revision

Viewing changes to contrib/openvpn/dhclient-enter-hooks

  • Committer: Bazaar Package Importer
  • Author(s): Simon Kelley
  • Date: 2005-09-03 20:02:32 UTC
  • mfrom: (0.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050903200232-76u3kbiz1hm4ok3u
Tags: 2.24-1
 * New upstream. (closes: #330422)
 * Fix typo and clean up dnsmasq.conf (closes: #326057) (closes: #304446)
 * Add build support for I18N and gettext.
 * Fixed manpage typos. (closes: #336413)
 * Create a dnsmasq-unique userid for the daemon to run as. (closes: #338353)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
function save_previous() {
 
4
  if [ -e $1 -a ! -e $1.predhclient ]; then
 
5
    mv $1 $1.predhclient 
 
6
  fi
 
7
}
 
8
 
 
9
function write_resolv_conf() {
 
10
  RESOLVCONF=$1
 
11
  if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
 
12
    save_previous $RESOLVCONF
 
13
    echo '; generated by /etc/dhclient-enter-hooks' > $RESOLVCONF
 
14
    if [ -n "$SEARCH" ]; then
 
15
        echo search $SEARCH >> $RESOLVCONF
 
16
    else
 
17
        if [ -n "$new_domain_name" ]; then
 
18
            echo search $new_domain_name >> $RESOLVCONF
 
19
        fi
 
20
    fi
 
21
    chmod 644 $RESOLVCONF
 
22
    for nameserver in $new_domain_name_servers; do
 
23
      echo nameserver $nameserver >>$RESOLVCONF
 
24
    done
 
25
  fi
 
26
}
 
27
 
 
28
make_resolv_conf() {
 
29
  write_resolv_conf /etc/resolv.conf
 
30
}