diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-03-05 19:31:16 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-03-05 19:31:16 +0000 |
commit | 4b0f970e4c15e4f4719ea3d017f80ada2fa9dfbd (patch) | |
tree | 37e909acec47834076d66e6240db66a773fe7855 | |
parent | 5f952d07e30b25c10bd66edd6154c0ea5eb94152 (diff) |
Stop using and copying the on-disk /etc/hosts file to the bsd.rd
/tmp dir during upgrade.
Create and use a minimal hosts file instead to avoid that a big
hosts file fills up the small bsd.rd / filesystem as reported
recently by Ted Roby.
Note that network interface configuration using hostnames instead
of ip addresses in hostname.if(5) relies on the on-disk /etc/hosts
file which is not used anymore during upgrade.
discussed with many
ok tb@, halex@
'sure' deraadt@
-rw-r--r-- | distrib/miniroot/install.sub | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 46af0f97556..fd44b6f45be 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.980 2017/03/01 20:48:12 rpe Exp $ +# $OpenBSD: install.sub,v 1.981 2017/03/05 19:31:15 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -2188,13 +2188,17 @@ ifstart () { enable_network() { local _f _gw _trunks _svlans _vlans - # Copy any network configuration files. N.B.: hosts already copied. + # Copy any network configuration files. for _f in dhclient.conf resolv.conf resolv.conf.tail; do if [[ -f /mnt/etc/$_f ]]; then cp /mnt/etc/$_f /etc/$_f fi done + # Create a minimal hosts file. + echo "127.0.0.1\tlocalhost" >/tmp/i/hosts + echo "::1\t\tlocalhost" >>/tmp/i/hosts + # Set the address for the loopback interface. Bringing the # interface up, automatically invokes the IPv6 address ::1. ifconfig lo0 inet 127.0.0.1/8 @@ -2894,8 +2898,8 @@ do_upgrade(){ mount -o ro /dev/$ROOTDEV /mnt || { echo "FAILED."; exit; } echo "OK." - # The fstab, hosts and myname files are required. - for _f in /mnt/etc/{fstab,hosts,myname}; do + # The fstab and myname files are required. + for _f in /mnt/etc/{fstab,myname}; do [[ -f $_f ]] || { echo "No $_f!"; exit; } cp $_f /tmp/i/${_f##*/} done |