summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/nsswitch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-05-24 11:53:26 +0000
committerdes <des@FreeBSD.org>2004-05-24 11:53:26 +0000
commitf55719c110b72cbd74029d9ffc3e20ce274b1f29 (patch)
tree1473b6bc73bfa1394b9d7a4242587aaad44d9208 /etc/rc.d/nsswitch
parent7d5a1a0c2b0bb381577a6bd818c7afd72388f9d5 (diff)
downloadFreeBSD-src-f55719c110b72cbd74029d9ffc3e20ce274b1f29.zip
FreeBSD-src-f55719c110b72cbd74029d9ffc3e20ce274b1f29.tar.gz
If nsswitch.conf does not exist, create it with the default settings.
The reason for doing this is that (at least some) 4.x binaries are very unhappy if host.conf does not exist, and if we create host.conf but not nsswitch.conf, nsswitch.conf will be created at the next reboot, so it is better to create a correct nsswitch.conf right away.
Diffstat (limited to 'etc/rc.d/nsswitch')
-rw-r--r--etc/rc.d/nsswitch37
1 files changed, 30 insertions, 7 deletions
diff --git a/etc/rc.d/nsswitch b/etc/rc.d/nsswitch
index 830467c..fe84fd9 100644
--- a/etc/rc.d/nsswitch
+++ b/etc/rc.d/nsswitch
@@ -54,6 +54,21 @@ convert_host_conf()
}' < $host_conf > $nsswitch_conf
}
+generate_nsswitch_conf()
+{
+ nsswitch_conf=$1; shift;
+
+ cat >$nsswitch_conf <<EOF
+group: compat
+group_compat: nis
+hosts: dns files
+networks: files
+passwd: compat
+passwd_compat: nis
+shells: files
+EOF
+}
+
generate_host_conf()
{
nsswitch_conf=$1; shift;
@@ -87,13 +102,6 @@ END {
nsswitch_start()
{
- # Generate host.conf for compatibility
- #
- if [ -f "/etc/nsswitch.conf" ]; then
- echo 'Generating host.conf.'
- generate_host_conf /etc/nsswitch.conf /etc/host.conf
- fi
-
# Convert host.conf to nsswitch.conf if necessary
#
if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
@@ -102,6 +110,21 @@ nsswitch_start()
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" ]; then
+ echo 'Generating host.conf.'
+ generate_host_conf /etc/nsswitch.conf /etc/host.conf
+ fi
+
}
load_rc_config $name
OpenPOWER on IntegriCloud