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? (for after release)
Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1205
diff -u -p -U7 -r1.1205 install.sub
--- install.sub 19 Sep 2022 15:40:36 -0000 1.1205
+++ install.sub 20 Sep 2022 15:08:31 -0000
@@ -3179,18 +3177,17 @@ do_install() {
# Add common entries.
echo "127.0.0.1\tlocalhost" >/mnt/etc/hosts
echo "::1\t\tlocalhost" >>/mnt/etc/hosts
# 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
echo "$_addr\t$_hn.$_dn $_hn"
fi
done </tmp/i/hosts >>/mnt/etc/hosts
rm /tmp/i/hosts