summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syspatch/syspatch.sh
diff options
context:
space:
mode:
authorajacoutot <ajacoutot@openbsd.org>2017-05-12 15:04:07 +0000
committerajacoutot <ajacoutot@openbsd.org>2017-05-12 15:04:07 +0000
commit1d213eec9562cd8af712230b8903fedfd1dc9fff (patch)
tree5bc6e7d9997d779582ddc8a266cc2ff696ee417f /usr.sbin/syspatch/syspatch.sh
parentNeed to store bg for ECH. (diff)
downloadwireguard-openbsd-1d213eec9562cd8af712230b8903fedfd1dc9fff.tar.xz
wireguard-openbsd-1d213eec9562cd8af712230b8903fedfd1dc9fff.zip
Make sure we have a valid URL in /etc/installurl to prevent ending up stuck in
ftp(1) interactive mode. reported by and OK sthen@
Diffstat (limited to 'usr.sbin/syspatch/syspatch.sh')
-rw-r--r--usr.sbin/syspatch/syspatch.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh
index 9cb41f06f73..41634339d1a 100644
--- a/usr.sbin/syspatch/syspatch.sh
+++ b/usr.sbin/syspatch/syspatch.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: syspatch.sh,v 1.100 2017/05/08 09:45:14 ajacoutot Exp $
+# $OpenBSD: syspatch.sh,v 1.101 2017/05/12 15:04:07 ajacoutot Exp $
#
# Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -286,7 +286,9 @@ _OSrev=${_KERNV[0]%.*}${_KERNV[0]#*.}
_MIRROR=$(while read _line; do _line=${_line%%#*}; [[ -n ${_line} ]] &&
print -r -- "${_line}"; done </etc/installurl | tail -1)
-[[ -z ${_MIRROR} ]] && sp_err "${0##*/}: no URL configured in /etc/installurl"
+[[ ${_MIRROR} == @(file|http|https)://*/*[!/] ]] ||
+ sp_err "${0##*/}: invalid URL configured in /etc/installurl"
+
_MIRROR="${_MIRROR}/syspatch/${_KERNV[0]}/$(machine)"
(($(sysctl -n hw.ncpufound) > 1)) && _BSDMP=true || _BSDMP=false