summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-05-12 15:04:08 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-05-12 15:04:08 +0000
commit4817542a48e4d50ff998258dc99a0a708132670f (patch)
tree986a61ec2103d9e95653189578f1f6241ab6d040 /usr.sbin
parent1a96eb1f2bfdb2c6ad3e2b4e72c052e17c4ac402 (diff)
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')
-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