diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-11-29 20:14:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-11-29 20:14:07 +0000 |
commit | ac2bd911058daacc24ff4291dbd1f64018e3f673 (patch) | |
tree | 56422725918aaeeaa358c373095cd2f16f7b68e3 /distrib | |
parent | 4f6aad51caa8d959e443433a10864db45d1820c3 (diff) |
Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 31f861cafaf..558e8601c80 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1155 2020/09/22 15:38:59 florian Exp $ +# $OpenBSD: install.sub,v 1.1156 2020/11/29 20:14:06 deraadt Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -2441,15 +2441,16 @@ enable_network() { # /mnt/etc/mygate, if it exists, contains the address(es) of my # default gateway(s). Use for ipv4 if no interfaces configured via # dhcp. Use for ipv6 if no interfaces configured via autoconf. - ! $V4_DHCPCONF && stripcom /mnt/etc/mygate | + stripcom /mnt/etc/mygate | while read _gw; do - [[ $_gw == @(*:*) ]] && continue - route -qn add -host default $_gw && break - done - ! $V6_AUTOCONF && stripcom /mnt/etc/mygate | - while read _gw; do - [[ $_gw == !(*:*) ]] && continue - route -qn add -host -inet6 default $_gw && break + [[ $_gw == '!'* ]] && continue + if [[ $_gw != @(*:*) ]]; then + $V4_DHCPCONF && continue + route -qn add -host default $_gw + elif [[ $_gw == @(*:*) ]]; then + $V6_AUTOCONF && continue + route -qn add -host -inet6 default $_gw + fi done route -qn add -net 127 127.0.0.1 -reject >/dev/null |