Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2013 22:03:29 +0000 (UTC)
From:      Steve Wills <swills@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r331066 - in head/sysutils: . firstboot-freebsd-update firstboot-freebsd-update/files
Message-ID:  <201310202203.r9KM3T3K003695@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310202203.r9KM3T3K003695>