Deleted Added
full compact
netoptions (85222) netoptions (85831)
1#!/bin/sh -
2#
3# Copyright (c) 1993 The FreeBSD Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
1#!/bin/sh -
2#
3# Copyright (c) 1993 The FreeBSD Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: head/etc/rc.d/netoptions 85222 2001-10-20 04:46:32Z darrenr $
27# $FreeBSD: head/etc/rc.d/netoptions 85831 2001-11-01 12:39:01Z des $
28# From: @(#)netstart 5.9 (Berkeley) 3/30/91
29#
30
31# Note that almost all of the user-configurable behavior is no longer in
32# this file, but rather in /etc/defaults/rc.conf. Please check that file
33# first before contemplating any changes here. If you do need to change
34# this file for some reason, we would like to know about it.
35
36# First pass startup stuff.
37#
38network_pass1() {
39 echo -n 'Doing initial network setup:'
40
28# From: @(#)netstart 5.9 (Berkeley) 3/30/91
29#
30
31# Note that almost all of the user-configurable behavior is no longer in
32# this file, but rather in /etc/defaults/rc.conf. Please check that file
33# first before contemplating any changes here. If you do need to change
34# this file for some reason, we would like to know about it.
35
36# First pass startup stuff.
37#
38network_pass1() {
39 echo -n 'Doing initial network setup:'
40
41 # Generate host.conf for compatibility
42 #
43 if [ -f "/etc/nsswitch.conf" ]; then
44 echo ''
45 echo 'Generating /etc/host.conf for compatibility'
46 generate_host_conf /etc/nsswitch.conf /etc/host.conf
47 fi
48
41 # Convert host.conf to nsswitch.conf if necessary
49 # Convert host.conf to nsswitch.conf if necessary
42 if [ -f "/etc/host.conf" ]; then
50 #
51 if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
43 echo ''
44 echo 'Warning: /etc/host.conf is no longer used'
52 echo ''
53 echo 'Warning: /etc/host.conf is no longer used'
45 if [ -f "/etc/nsswitch.conf" ]; then
46 echo ' /etc/nsswitch.conf will be used instead'
47 else
48 echo ' /etc/nsswitch.conf will be created for you'
49 convert_host_conf /etc/host.conf /etc/nsswitch.conf
50 fi
54 echo ' /etc/nsswitch.conf will be created for you'
55 convert_host_conf /etc/host.conf /etc/nsswitch.conf
51 fi
52
53 # Set the host name if it is not already set
54 #
55 if [ -z "`hostname -s`" ]; then
56 hostname ${hostname}
57 echo -n ' hostname'
58 fi

--- 802 unchanged lines hidden (view full) ---

861 { printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \
862 END { \
863 printf "hosts: "; \
864 for (i in nsswitch) printf "%s ", nsswitch[i]; \
865 printf "\n"; \
866 }' < $host_conf > $nsswitch_conf
867}
868
56 fi
57
58 # Set the host name if it is not already set
59 #
60 if [ -z "`hostname -s`" ]; then
61 hostname ${hostname}
62 echo -n ' hostname'
63 fi

--- 802 unchanged lines hidden (view full) ---

866 { printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \
867 END { \
868 printf "hosts: "; \
869 for (i in nsswitch) printf "%s ", nsswitch[i]; \
870 printf "\n"; \
871 }' < $host_conf > $nsswitch_conf
872}
873
874generate_host_conf() {
875 nsswitch_conf=$1; shift;
876 host_conf=$1; shift;
877
878 awk '
879BEGIN {
880 xlat["files"] = "hosts";
881 xlat["dns"] = "bind";
882 xlat["nis"] = "nis";
883}
884/^hosts:/ {
885 print "# Auto-generated, do not edit";
886 for (n = 2; n <= NF; ++n)
887 if ($n in xlat)
888 print xlat[$n];
889 quit;
890}
891// {
892 next;
893}
894' <$nsswitch_conf >$host_conf
895}