Bug 183130 - [new port] sysutils/firstboot-freebsd-update
[new port] sysutils/firstboot-freebsd-update
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Steve Wills
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-20 22:30 UTC by Colin Percival
Modified: 2013-10-20 23:10 UTC (History)
0 users

See Also:


Attachments
firstboot-freebsd-update.shar (2.55 KB, text/plain)
2013-10-20 22:30 UTC, Colin Percival
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Percival freebsd_committer 2013-10-20 22:30:02 UTC
Using new "first boot" rc.d script functionality, this port (if enabled
via firstboot_freebsd_update_enable="YES") downloads and installs FreeBSD
updates when the system is first booted.

Fix: Please review that I did this right... I don't create ports very often.
Comment 1 Edwin Groothuis freebsd_committer 2013-10-20 22:30:16 UTC
Responsible Changed
From-To: freebsd-ports-bugs->cperciva

Submitter has GNATS access (via the GNATS Auto Assign Tool)
Comment 2 Steve Wills freebsd_committer 2013-10-20 23:02:38 UTC
Responsible Changed
From-To: cperciva->swills

I'll take it.
Comment 3 dfilter freebsd_committer 2013-10-20 23:03:44 UTC
Author: swills
Date: Sun Oct 20 22:03:29 2013
New Revision: 331066
URL: http://svnweb.freebsd.org/changeset/ports/331066

Log:
  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.
  
  PR:		ports/183130
  Submitted by:	cperciva@FreeBSD.org

Added:
  head/sysutils/firstboot-freebsd-update/
  head/sysutils/firstboot-freebsd-update/Makefile   (contents, props changed)
  head/sysutils/firstboot-freebsd-update/files/
  head/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in   (contents, props changed)
  head/sysutils/firstboot-freebsd-update/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Sun Oct 20 21:57:18 2013	(r331065)
+++ head/sysutils/Makefile	Sun Oct 20 22:03:29 2013	(r331066)
@@ -242,6 +242,7 @@
     SUBDIR += filetype
     SUBDIR += filewatcherd
     SUBDIR += finfo
+    SUBDIR += firstboot-freebsd-update
     SUBDIR += flasher
     SUBDIR += flashrom
     SUBDIR += flexbackup

Added: head/sysutils/firstboot-freebsd-update/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-freebsd-update/Makefile	Sun Oct 20 22:03:29 2013	(r331066)
@@ -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>

Added: head/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-freebsd-update/files/firstboot_freebsd_update.in	Sun Oct 20 22:03:29 2013	(r331066)
@@ -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"
+

Added: head/sysutils/firstboot-freebsd-update/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-freebsd-update/pkg-descr	Sun Oct 20 22:03:29 2013	(r331066)
@@ -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.
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Steve Wills freebsd_committer 2013-10-20 23:03:51 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!