Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Nov 2013 00:17:00 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r335251 - in head/sysutils: . firstboot-pkgs firstboot-pkgs/files
Message-ID:  <201311300017.rAU0H1vj079544@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Sat Nov 30 00:17:00 2013
New Revision: 335251
URL: http://svnweb.freebsd.org/changeset/ports/335251

Log:
  Add firstboot-pkgs:
  
  When the system first boots, install the pkg(8) tools (if not already
  installed) and packages listed in the $firstboot_pkgs_list rc.conf
  variable.
  
  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.

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

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Fri Nov 29 23:55:54 2013	(r335250)
+++ head/sysutils/Makefile	Sat Nov 30 00:17:00 2013	(r335251)
@@ -243,6 +243,7 @@
     SUBDIR += filewatcherd
     SUBDIR += finfo
     SUBDIR += firstboot-freebsd-update
+    SUBDIR += firstboot-pkgs
     SUBDIR += flasher
     SUBDIR += flashrom
     SUBDIR += flexbackup

Added: head/sysutils/firstboot-pkgs/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-pkgs/Makefile	Sat Nov 30 00:17:00 2013	(r335251)
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+PORTNAME=	firstboot-pkgs
+PORTVERSION=	1.0
+CATEGORIES=	sysutils
+MASTER_SITES=	# none
+DISTFILES=	# none
+
+MAINTAINER=	cperciva@FreeBSD.org
+COMMENT=	Install packages when the system first boots
+
+NO_WRKSUBDIR=	yes
+NO_BUILD=	yes
+
+USE_RC_SUBR=	firstboot_pkgs
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 902504 || ( ${OSVERSION} >= 1000000 && ${OSVERSION} < 1000501 ) || ( ${OSVERSION} >= 1100000 && ${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-pkgs/files/firstboot_pkgs.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-pkgs/files/firstboot_pkgs.in	Sat Nov 30 00:17:00 2013	(r335251)
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# $FreeBSD$
+# KEYWORD: firstboot
+# PROVIDE: firstboot_pkgs
+# REQUIRE: 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_pkgs_enable="YES"
+#
+# and place a list of packages in firstboot_pkgs_list, e.g.,
+#
+# firstboot_pkgs_list="apache22 php5 mysql56-server"
+
+. /etc/rc.subr
+
+: ${firstboot_pkgs_enable:="NO"}
+
+name="firstboot_pkgs"
+rcvar=firstboot_pkgs_enable
+start_cmd="firstboot_pkgs_run"
+stop_cmd=":"
+
+firstboot_pkgs_run()
+{
+
+	# Bootstrap if necessary
+	if ! pkg -N 2>/dev/null; then
+		env ASSUME_ALWAYS_YES=YES pkg bootstrap
+	fi
+
+	# Install requested packages, if any
+	if ! [ -z "$firstboot_pkgs_list" ]; then
+		env ASSUME_ALWAYS_YES=YES pkg install $firstboot_pkgs_list
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"

Added: head/sysutils/firstboot-pkgs/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/firstboot-pkgs/pkg-descr	Sat Nov 30 00:17:00 2013	(r335251)
@@ -0,0 +1,7 @@
+When the system first boots, install the pkg(8) tools (if not already
+installed) and packages listed in the $firstboot_pkgs_list rc.conf
+variable.
+
+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?201311300017.rAU0H1vj079544>