summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2005-10-12 02:48:49 +0000
committerkrw <krw@openbsd.org>2005-10-12 02:48:49 +0000
commitd82ae871dfa76cb8e336e619aa5e85eb528e415f (patch)
tree2ad48963b9967e54f5a3c62d0e8110b216b2d688
parentadd -f to #! at top; from bruno@rohee.com (diff)
downloadwireguard-openbsd-d82ae871dfa76cb8e336e619aa5e85eb528e415f.tar.xz
wireguard-openbsd-d82ae871dfa76cb8e336e619aa5e85eb528e415f.zip
Comments are now allowed in myname and mygate. Steal stripcom() from
/etc/netstart and use in myname and mygate processing. Fixes problems with (U)pgrade's. Discovered while preparing for Todd's new mygate functionality. ok todd@
-rw-r--r--distrib/miniroot/install.sub13
-rw-r--r--distrib/miniroot/upgrade.sh4
2 files changed, 13 insertions, 4 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index b6a6e038924..2737363f50a 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.392 2005/10/10 19:23:06 krw Exp $
+# $OpenBSD: install.sub,v 1.393 2005/10/12 02:48:49 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2005 Todd Miller, Theo de Raadt, Ken Westerback
@@ -169,6 +169,15 @@ __EOT
echo "Cool! Let's get to it."
}
+# Echo the file $1 to standard output, skipping any lines that begin with a
+# '#'. i.e. strip comment lines from the file.
+stripcom () {
+ local _l
+ while read _l; do
+ [[ -n ${_l%%#*} ]] && echo $_l
+ done <$1
+}
+
scan_dmesg() {
bsort $(sed -ne "$1" /var/run/dmesg.boot)
}
@@ -878,7 +887,7 @@ enable_network() {
# that name must be in /etc/hosts.
if [ -f /mnt/etc/mygate ]; then
route delete default >/dev/null 2>&1
- route -qn add -host default $(</mnt/etc/mygate)
+ route -qn add -host default $(stripcom /mnt/etc/mygate)
fi
# Use loopback, not the wire.
diff --git a/distrib/miniroot/upgrade.sh b/distrib/miniroot/upgrade.sh
index d1a78f3e055..4fe23e6e1c5 100644
--- a/distrib/miniroot/upgrade.sh
+++ b/distrib/miniroot/upgrade.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: upgrade.sh,v 1.61 2005/04/02 14:27:08 krw Exp $
+# $OpenBSD: upgrade.sh,v 1.62 2005/10/12 02:48:49 krw Exp $
# $NetBSD: upgrade.sh,v 1.2.4.5 1996/08/27 18:15:08 gwr Exp $
#
# Copyright (c) 1997-2004 Todd Miller, Theo de Raadt, Ken Westerback
@@ -82,7 +82,7 @@ for _file in fstab hosts myname; do
fi
cp /mnt/etc/$_file /tmp/$_file
done
-hostname $(</tmp/myname)
+hostname $(stripcom /tmp/myname)
ask_yn "Enable network using configuration stored on root filesystem?" yes
[[ $resp == y ]] && enable_network