aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/firstboot-freebsd-update/Makefile26
-rw-r--r--sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in28
-rw-r--r--sysutils/firstboot-freebsd-update/pkg-descr6
4 files changed, 61 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index c6f66e80d646..d6150bbac8fc 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -242,6 +242,7 @@
SUBDIR += filetype
SUBDIR += filewatcherd
SUBDIR += finfo
+ SUBDIR += firstboot-freebsd-update
SUBDIR += flasher
SUBDIR += flashrom
SUBDIR += flexbackup
diff --git a/sysutils/firstboot-freebsd-update/Makefile b/sysutils/firstboot-freebsd-update/Makefile
new file mode 100644
index 000000000000..6043af89ca36
--- /dev/null
+++ b/sysutils/firstboot-freebsd-update/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+PORTNAME= firstboot-freebsd-update
+PORTVERSION= 1.0
+CATEGORIES= sysutils
+MASTER_SITES= # none
+DISTFILES= # none
+
+MAINTAINER= cperciva@FreeBSD.org
+COMMENT= Update the system using freebsd-update when it first boots
+
+NO_WRKSUBDIR= yes
+NO_BUILD= yes
+
+USE_RC_SUBR= firstboot_freebsd_update
+
+.include <bsd.port.pre.mk>
+
+.if ( ${OSVERSION} < 1100001 )
+IGNORE= first boot rc.d scripts not supported on this version of FreeBSD
+.endif
+
+do-fetch do-install:
+ @${DO_NADA}
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in b/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in
new file mode 100644
index 000000000000..170fdf722676
--- /dev/null
+++ b/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# KEYWORD: firstboot
+# PROVIDE: firstboot_freebsd_update
+# REQUIRE: syslogd NETWORKING
+# BEFORE: LOGIN
+
+. /etc/rc.subr
+
+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"
+
diff --git a/sysutils/firstboot-freebsd-update/pkg-descr b/sysutils/firstboot-freebsd-update/pkg-descr
new file mode 100644
index 000000000000..86e811b46a9f
--- /dev/null
+++ b/sysutils/firstboot-freebsd-update/pkg-descr
@@ -0,0 +1,6 @@
+Run 'freebsd-update fetch' when the system first boots; and if updates are
+downloaded, install them and request a reboot.
+
+Obviously, this port is not useful after a system is already running; it is
+intended to be included as part of the installation or disk image building
+process.