aboutsummaryrefslogtreecommitdiff
path: root/sysutils/firstboot-freebsd-update
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2013-10-20 22:03:29 +0000
committerSteve Wills <swills@FreeBSD.org>2013-10-20 22:03:29 +0000
commitd592d67b0d5bc29c86cab27b5c39d68e934527cd (patch)
tree736537db502b4f567a568bd158ab5e01db2cd801 /sysutils/firstboot-freebsd-update
parenteba0e3e1de05dc7cf3de423a1db1b54c54502ab8 (diff)
downloadports-d592d67b0d5bc29c86cab27b5c39d68e934527cd.tar.gz
ports-d592d67b0d5bc29c86cab27b5c39d68e934527cd.zip
Notes
Diffstat (limited to 'sysutils/firstboot-freebsd-update')
-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
3 files changed, 60 insertions, 0 deletions
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.