summaryrefslogtreecommitdiff
path: root/distrib/miniroot/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'distrib/miniroot/install.sh')
-rw-r--r--distrib/miniroot/install.sh34
1 files changed, 13 insertions, 21 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh
index 0056fd73818..c7bd16e2bb8 100644
--- a/distrib/miniroot/install.sh
+++ b/distrib/miniroot/install.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sh,v 1.163 2009/03/14 14:23:05 krw Exp $
+# $OpenBSD: install.sh,v 1.164 2009/03/14 15:55:39 krw Exp $
# $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -362,16 +362,10 @@ echo -n "Saving configuration files..."
( cd /tmp
hostname >myname
-# Prepend localhost entries and add FQDN to /tmp/hosts entries, changing lines
-# of the form '1.2.3.4 hostname' to '1.2.3.4 hostname.$FQDN hostname'. Leave
-# untouched any lines containing 'localhost', domain information or aliases. The
-# first should not have domain info and the latter the user added manually.
-
-cat >hosts.new <<__EOT
-::1 localhost
-127.0.0.1 localhost
-__EOT
-
+# Append entries to installed hosts file, changing '1.2.3.4 hostname'
+# to '1.2.3.4 hostname.$FQDN hostname'. Leave untouched lines containing
+# domain information or aliases. These are lines the user added/changed
+# manually.
_dn=$(get_fqdn)
while read _addr _hn _aliases; do
if [[ -n $_aliases || $_hn != ${_hn%%.*} || -z $_dn ]]; then
@@ -379,19 +373,17 @@ while read _addr _hn _aliases; do
else
echo "$_addr\t$_hn.$_dn $_hn"
fi
-done <hosts >>hosts.new
-mv hosts.new hosts
+done <hosts >>/mnt/etc/hosts
+rm hosts
-# Prepend interesting comments from installed hosts and dhclient.conf files
-# to /tmp/hosts and /tmp/dhclient.conf.
-save_comments hosts
-save_comments dhclient.conf
+# Append dhclient.conf to installed dhclient.conf.
+_f=dhclient.conf
+[[ -f $_f ]] && { cat $_f >>/mnt/etc/$_f ; rm $_f ; }
-# Possible files: fstab hostname.* hosts kbdtype mygate myname ttys
-# boot.conf dhclient.conf resolv.conf sysctl.conf
-# resolv.conf.tail
+# Possible files: fstab hostname.* kbdtype mygate myname ttys
+# boot.conf resolv.conf sysctl.conf resolv.conf.tail
# Save only non-empty (-s) regular (-f) files.
-for _f in fstab host* kbdtype my* ttys *.conf *.tail; do
+for _f in fstab hostname* kbdtype my* ttys *.conf *.tail; do
[[ -f $_f && -s $_f ]] && mv $_f /mnt/etc/.
done )