diff options
-rw-r--r-- | sysutils/Makefile | 1 | ||||
-rw-r--r-- | sysutils/firstboot-pkgs/Makefile | 26 | ||||
-rw-r--r-- | sysutils/firstboot-pkgs/files/firstboot_pkgs.in | 42 | ||||
-rw-r--r-- | sysutils/firstboot-pkgs/pkg-descr | 7 |
4 files changed, 76 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile index b97275db52a8..ad765000def8 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -243,6 +243,7 @@ SUBDIR += filewatcherd SUBDIR += finfo SUBDIR += firstboot-freebsd-update + SUBDIR += firstboot-pkgs SUBDIR += flasher SUBDIR += flashrom SUBDIR += flexbackup diff --git a/sysutils/firstboot-pkgs/Makefile b/sysutils/firstboot-pkgs/Makefile new file mode 100644 index 000000000000..46a6e8b5dc8f --- /dev/null +++ b/sysutils/firstboot-pkgs/Makefile @@ -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> diff --git a/sysutils/firstboot-pkgs/files/firstboot_pkgs.in b/sysutils/firstboot-pkgs/files/firstboot_pkgs.in new file mode 100644 index 000000000000..ba3b9ffbfcef --- /dev/null +++ b/sysutils/firstboot-pkgs/files/firstboot_pkgs.in @@ -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" diff --git a/sysutils/firstboot-pkgs/pkg-descr b/sysutils/firstboot-pkgs/pkg-descr new file mode 100644 index 000000000000..0dfc37e7ddf2 --- /dev/null +++ b/sysutils/firstboot-pkgs/pkg-descr @@ -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. |