freebsd-ports/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in
Colin Percival 440ee7e0ef Set ${firstboot_freebsd_update_enable} to NO by default.
Bump version to 1.1 for the change.
2013-10-28 00:06:49 +00:00

35 lines
803 B
Bash

#!/bin/sh
# KEYWORD: firstboot
# PROVIDE: firstboot_freebsd_update
# REQUIRE: syslogd NETWORKING
# BEFORE: LOGIN
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf (in the disk
# image, since this only runs on the first boot) to enable this:
#
# firstboot_freebsd_update_enable="YES"
. /etc/rc.subr
: ${firstboot_freebsd_update_enable:="NO"}
name="firstboot_freebsd_update"
rcvar=firstboot_freebsd_update_enable
start_cmd="firstboot_freebsd_update_run | logger -s -t 'freebsd-update'"
stop_cmd=":"
firstboot_freebsd_update_run()
{
freebsd-update fetch
if [ -e /var/db/freebsd-update/`echo / | sha256`-install ]; then
freebsd-update install
echo "Requesting reboot after installing updates."
touch ${firstboot_sentinel}-reboot
fi
}
load_rc_config $name
run_rc_command "$1"