From owner-svn-ports-head@FreeBSD.ORG Sat Nov 30 00:17:01 2013 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D63CC8B5; Sat, 30 Nov 2013 00:17:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C16A2183F; Sat, 30 Nov 2013 00:17:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAU0H1XD079551; Sat, 30 Nov 2013 00:17:01 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAU0H1vj079544; Sat, 30 Nov 2013 00:17:01 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201311300017.rAU0H1vj079544@svn.freebsd.org> From: Colin Percival Date: Sat, 30 Nov 2013 00:17:00 +0000 (UTC) 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 X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Nov 2013 00:17:02 -0000 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 + +.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 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.