Install /etc/nsswitch.conf statically rather than generating it at
boot. Autogeneration of nsswitch.conf doesn't makes sense in 7.0 since it's not permitted to upgrade from a pre-nss release without passing through an intermediate release. Suggested by: brooks
This commit is contained in:
parent
a59756eac2
commit
bc8c6150b8
@ -11,8 +11,8 @@ BIN1= amd.map apmd.conf auth.conf \
|
||||
crontab csh.cshrc csh.login csh.logout devd.conf devfs.conf \
|
||||
dhclient.conf disktab fbtab ftpusers gettytab group \
|
||||
hosts hosts.allow hosts.equiv hosts.lpd \
|
||||
inetd.conf login.access login.conf \
|
||||
mac.conf motd netconfig network.subr networks newsyslog.conf \
|
||||
inetd.conf login.access login.conf mac.conf motd \
|
||||
netconfig network.subr networks newsyslog.conf nsswitch.conf \
|
||||
portsnap.conf pf.conf pf.os phones profile protocols \
|
||||
rc rc.bsdextended rc.firewall rc.firewall6 rc.initdiskless \
|
||||
rc.sendmail rc.shutdown \
|
||||
|
15
etc/nsswitch.conf
Normal file
15
etc/nsswitch.conf
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# nsswitch.conf(5) - name service switch configuration file
|
||||
# $FreeBSD$
|
||||
#
|
||||
group: compat
|
||||
group_compat: nis
|
||||
hosts: files dns
|
||||
networks: files
|
||||
passwd: compat
|
||||
passwd_compat: nis
|
||||
shells: files
|
||||
services: compat
|
||||
services_compat: nis
|
||||
protocols: files
|
||||
rpc: files
|
@ -36,54 +36,6 @@ name="nsswitch"
|
||||
start_cmd="nsswitch_start"
|
||||
stop_cmd=":"
|
||||
|
||||
convert_host_conf()
|
||||
{
|
||||
host_conf=$1; shift;
|
||||
nsswitch_conf=$1; shift;
|
||||
|
||||
while read line; do
|
||||
line=${line##[ ]}
|
||||
case $line in
|
||||
hosts|local|file)
|
||||
_nsswitch="${_nsswitch}${_nsswitch+ }files"
|
||||
;;
|
||||
dns|bind)
|
||||
_nsswitch="${_nsswitch}${_nsswitch+ }dns"
|
||||
;;
|
||||
nis)
|
||||
_nsswitch="${_nsswitch}${_nsswitch+ }nis"
|
||||
;;
|
||||
'#'*)
|
||||
;;
|
||||
*)
|
||||
printf "Warning: unrecognized line [%s]", $line > "/dev/stderr"
|
||||
;;
|
||||
|
||||
esac
|
||||
done < $host_conf
|
||||
|
||||
echo "hosts: $_nsswitch" > $nsswitch_conf
|
||||
}
|
||||
|
||||
generate_nsswitch_conf()
|
||||
{
|
||||
nsswitch_conf=$1; shift;
|
||||
|
||||
cat >$nsswitch_conf <<EOF
|
||||
group: compat
|
||||
group_compat: nis
|
||||
hosts: files dns
|
||||
networks: files
|
||||
passwd: compat
|
||||
passwd_compat: nis
|
||||
shells: files
|
||||
services: compat
|
||||
services_compat: nis
|
||||
protocols: files
|
||||
rpc: files
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_host_conf()
|
||||
{
|
||||
nsswitch_conf=$1; shift;
|
||||
@ -134,22 +86,6 @@ generate_host_conf()
|
||||
|
||||
nsswitch_start()
|
||||
{
|
||||
# Convert host.conf to nsswitch.conf if necessary
|
||||
#
|
||||
if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
|
||||
echo ''
|
||||
echo 'Warning: /etc/host.conf is no longer used'
|
||||
echo ' /etc/nsswitch.conf will be created for you'
|
||||
convert_host_conf /etc/host.conf /etc/nsswitch.conf
|
||||
fi
|
||||
|
||||
# Generate default nsswitch.conf if none exists
|
||||
#
|
||||
if [ ! -f "/etc/nsswitch.conf" ]; then
|
||||
echo 'Generating nsswitch.conf.'
|
||||
generate_nsswitch_conf /etc/nsswitch.conf
|
||||
fi
|
||||
|
||||
# Generate host.conf for compatibility
|
||||
#
|
||||
if [ ! -f "/etc/host.conf" -o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user