Teach the firstboot-freebsd-update script to disable itself if it is run

on something other than *-BETA*, *-RC*, or *-RELEASE*.  There won't be
any bits available to download, and if we don't disable it then the first
boot will be slowed down due to freebsd-update trying all of the available
mirrors.
This commit is contained in:
Colin Percival 2015-03-31 01:26:19 +00:00
parent d0bd54e741
commit 042e134f95
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=382788
2 changed files with 20 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# $FreeBSD$
PORTNAME= firstboot-freebsd-update
PORTVERSION= 1.1
PORTVERSION= 1.2
CATEGORIES= sysutils
MASTER_SITES= # none
DISTFILES= # none

View File

@ -9,10 +9,18 @@
# image, since this only runs on the first boot) to enable this:
#
# firstboot_freebsd_update_enable="YES"
#
# By default this script will only run on *-BETA*, *-RC*, and *-RELEASE*
# systems, since those are the only ones for which updates are provided by
# the FreeBSD project; to run freebsd-update anyway (e.g., on a custom
# release for which you are providing your own update bits), set:
#
# firstboot_freebsd_update_nonstandard="YES"
. /etc/rc.subr
: ${firstboot_freebsd_update_enable:="NO"}
: ${firstboot_freebsd_update_nonstandard:="NO"}
name="firstboot_freebsd_update"
rcvar=firstboot_freebsd_update_enable
@ -22,6 +30,17 @@ stop_cmd=":"
firstboot_freebsd_update_run()
{
if ! checkyesno firstboot_freebsd_update_nonstandard; then
case "`uname -r`" in
*-BETA* | *-RC* | *-RELEASE*)
;;
*)
echo "Firstboot freebsd-update disabled on `uname -r`"
return 0
;;
esac
fi
freebsd-update fetch
if [ -e /var/db/freebsd-update/`echo / | sha256`-install ]; then
freebsd-update install