Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / make_resolv_conf
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         make_resolv_conf
5 # Description:  A script to create a valid /etc/resolv.conf
6 # Author:       Andrew DeFaria, California Language Labs
7 # Created:      Wed Jan 15 16:52:22 PST 1997
8 # Modified:     Wed Jan 15 16:52:22 PST 1997 (Andrew DeFaria) defaria@cup.hp.com
9 # Language:     Korn Shell
10 #
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 me=$(basename $0)
15
16 function usage {
17   print -u2 "$me: [ <primary dns> ] [ <secondary dns> ]"
18   exit 1
19 } # usage
20
21 # Get parameters
22 primary_dns="15.28.98.95                # smildon"
23 secondary_dns="15.0.96.86               # masher"
24 trierary_dns="15.13.168.80              # hparch4"
25
26 if [ $# -eq 2 ]; then
27   primary_dns="$1"
28   secondary_dns="$2"
29 elif [ $# -eq 1 ]; then
30   primary_dns="$1"
31 fi
32
33 resolv_conf_file=/etc/resolv.conf
34
35 # Don't copy this time...
36 #cp $resolv_conf_file $resolv_conf_file.old
37
38 print "domain cup.hp.com"                         >  $resolv_conf_file
39 print "search cup.hp.com hp.com ch.apollo.hp.com" >> $resolv_conf_file
40 print "nameserver $primary_dns"                   >> $resolv_conf_file
41 print "nameserver $secondary_dns"                 >> $resolv_conf_file
42 print "nameserver $trierary_dns"                  >> $resolv_conf_file
43
44 # If machine runs cupmail (see root crontab) then we need to make a .local
45 # file.
46 cp $resolv_conf_file $resolv_conf_file.local
47
48 print "$me: Created new $resolv_conf_file"
49 #print "$me: Saved old $resolv_conf_file in $resolv_conf_file.old"