diff options
author | 2013-11-12 13:20:47 +0000 | |
---|---|---|
committer | 2013-11-12 13:20:47 +0000 | |
commit | 9bad58e2e907ca9aa129c6fe72e372cb4065dee4 (patch) | |
tree | dd9cfe527bcfabaee6911887b7c1f4fc36e39c58 | |
parent | remove the code that iterates over binary types, since everything is now (diff) | |
download | wireguard-openbsd-9bad58e2e907ca9aa129c6fe72e372cb4065dee4.tar.xz wireguard-openbsd-9bad58e2e907ca9aa129c6fe72e372cb4065dee4.zip |
Rework get_responsefile()
- Take netboot interface down and so kill a dhclient from a previous
attempt and to free up the only bpf which exists in this installstage.
Without this, we're not able to "restart" autoinstall because dhclient
fails due to lack of bpf's. dhclient takes the interface up again.
- Remove -s leasefile check, it's implicitly done with -n SERVER check.
- Avoid possible sed error msgs by redirecting STDERR to /dev/null.
- Fetch install.conf in a ftp on-liner whithout unneccessary URL var.
- Shorten -s install.conf check,
- [] -> [[]] for consistency
ok krw@
-rw-r--r-- | distrib/miniroot/install.sub | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 4402432ab06..77e4489efed 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.691 2013/11/09 22:37:53 rpe Exp $ +# $OpenBSD: install.sub,v 1.692 2013/11/12 13:20:47 rpe Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback @@ -2099,25 +2099,27 @@ done get_responsefile() { # Fetching the response file requires DHCP, even if the # machine was booted via RARP and TFTP. - [ -x /sbin/dhclient ] || return + [[ -x /sbin/dhclient ]] || return # Did we do a netboot? BOOTDEV=$(get_ifdevs netboot) [[ -n $BOOTDEV ]] || return + # Take interface down killing a dhclient from a previous attempt + # and so free up the only bpf which exists in this installstage. + ifconfig $BOOTDEV down + # Try to get a DHCP lease. This whole process is done in the # background, so it doesn't matter how long the timeout is. dhclient $BOOTDEV - [ -s /var/db/dhclient.leases.$BOOTDEV ] || return # Get the "next-server" address? SERVER=$(sed "/next-server/s/^.* \([^ ]*\);$/\1/p;d" \ - /var/db/dhclient.leases.$BOOTDEV) + /var/db/dhclient.leases.$BOOTDEV 2>/dev/null) [[ -n $SERVER ]] || return - URL="http://$SERVER/install.conf" - ftp -o "$1" "$URL" - [ -s "$1" ] || return + ftp -o "$1" "http://$SERVER/install.conf" + [[ -s $1 ]] } # Fully automatic installation? |