From: kn Date: Tue, 27 Sep 2022 12:22:29 +0000 (+0000) Subject: simpler ftplist[0-9].o.o removal X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=40e8b748dbe492eef982c572cf333d5b38c59c8d;p=openbsd simpler ftplist[0-9].o.o removal We read /tmp/i/hosts line-wise to fill /mnt/etc/hosts and remove the tmp file immediately afterwards, so just skip ftplist entries inside the loop with a slightly easier to read ksh pattern rather than purge the tmp file up-front with sed(1). This is also a tiny bit more robust should the ftplist entries ever be added with a tab as separator instead of a space and/or an alias since the sed one-liner hardcodes a single space and expects no alias whereas ksh's read takes any amount of whitespace between _addr and _hn while not caring about optional aliases. Comment is obvious so zap it. OK millert --- diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 8730a3d9612..ad549124a14 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1205 2022/09/19 15:40:36 florian Exp $ +# $OpenBSD: install.sub,v 1.1206 2022/09/27 12:22:29 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -3183,10 +3183,9 @@ do_install() { # Note we may have no hosts file if no interfaces were configured. if [[ -f /tmp/i/hosts ]]; then - # Remove the entry for ftplist*.openbsd.org - sed -i '/ ftplist[0-9]\.openbsd\.org$/d' /tmp/i/hosts _dn=$(get_fqdn) while read _addr _hn _aliases; do + [[ $_hn == ftplist[0-9].openbsd.org ]] && continue if [[ -n $_aliases || $_hn != ${_hn%%.*} || -z $_dn ]]; then echo "$_addr\t$_hn $_aliases" else