diff options
author | jmmv <jmmv@pkgsrc.org> | 2012-07-25 12:20:08 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2012-07-25 12:20:08 +0000 |
commit | 59c2e287fbfffd4509fa0166816a371a6df5d41b (patch) | |
tree | bb3fb53414130f5d799b944226092b79037b68bd | |
parent | f21da47225ca2b6f8876f25150323d6c2da1c2f5 (diff) | |
download | pkgsrc-59c2e287fbfffd4509fa0166816a371a6df5d41b.tar.gz |
Initial addition of sysbuild-user, version 1.0:
This package installs an unprivileged user for the sysbuild utility
provided by the sysutils/sysbuild package. This unprivileged user is
automatically configured to perform daily NetBSD builds.
-rw-r--r-- | sysutils/sysbuild-user/DESCR | 3 | ||||
-rw-r--r-- | sysutils/sysbuild-user/INSTALL | 23 | ||||
-rw-r--r-- | sysutils/sysbuild-user/MESSAGE | 17 | ||||
-rw-r--r-- | sysutils/sysbuild-user/Makefile | 56 | ||||
-rw-r--r-- | sysutils/sysbuild-user/PLIST | 3 | ||||
-rw-r--r-- | sysutils/sysbuild-user/files/crontab | 8 | ||||
-rw-r--r-- | sysutils/sysbuild-user/files/default.conf | 32 |
7 files changed, 142 insertions, 0 deletions
diff --git a/sysutils/sysbuild-user/DESCR b/sysutils/sysbuild-user/DESCR new file mode 100644 index 00000000000..ba47afeb099 --- /dev/null +++ b/sysutils/sysbuild-user/DESCR @@ -0,0 +1,3 @@ +This package installs an unprivileged user for the sysbuild utility +provided by the sysutils/sysbuild package. This unprivileged user is +automatically configured to perform daily NetBSD builds. diff --git a/sysutils/sysbuild-user/INSTALL b/sysutils/sysbuild-user/INSTALL new file mode 100644 index 00000000000..a0baaf51dfb --- /dev/null +++ b/sysutils/sysbuild-user/INSTALL @@ -0,0 +1,23 @@ +#! /bin/sh + +EGDIR="@EGDIR@" +SYSBUILD_HOME="@SYSBUILD_HOME@" +SYSBUILD_USER="@SYSBUILD_USER@" + +case "${STAGE}" in + POST-INSTALL) + if [ ! -e "${SYSBUILD_HOME}/.sysbuild/default.conf" ]; then + echo "${PKGNAME}: Installing default configuration file" + ${MKDIR} -p "${SYSBUILD_HOME}/.sysbuild" + ( cd "${SYSBUILD_HOME}/.sysbuild" && ln -s ../default.conf . ) + fi + + if crontab -u "${SYSBUILD_USER}" -l >/dev/null 2>/dev/null; then + echo "${PKGNAME}: ${SYSBUILD_USER} already has a crontab;" \ + "not installing" + else + echo "${PKGNAME}: Installing default crontab for ${SYSBUILD_USER}" + crontab -u "${SYSBUILD_USER}" "${EGDIR}/crontab" + fi + ;; +esac diff --git a/sysutils/sysbuild-user/MESSAGE b/sysutils/sysbuild-user/MESSAGE new file mode 100644 index 00000000000..e63f2101158 --- /dev/null +++ b/sysutils/sysbuild-user/MESSAGE @@ -0,0 +1,17 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1 2012/07/25 12:20:08 jmmv Exp $ + +A new system user has been set up to perform daily rebuilds of NetBSD for +the current platform. Please take the time to review the following file: + + ${SYSBUILD_HOME}/default.conf + +And make sure that the installed cron job runs at appropriate times: + + crontab -u ${SYSBUILD_USER} -e + +Lastly, remember that you can trigger manual sysbuild operations by doing: + + su - ${SYSBUILD_USER} ${PREFIX}/bin/sysbuild <arguments> + +=========================================================================== diff --git a/sysutils/sysbuild-user/Makefile b/sysutils/sysbuild-user/Makefile new file mode 100644 index 00000000000..ad1db780eed --- /dev/null +++ b/sysutils/sysbuild-user/Makefile @@ -0,0 +1,56 @@ +# $NetBSD: Makefile,v 1.1 2012/07/25 12:20:08 jmmv Exp $ + +DISTNAME= sysbuild-user-1.0 +CATEGORIES= sysutils +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= jmmv@NetBSD.org +COMMENT= Runs sysbuild periodically under a dedicated user +LICENSE= modified-bsd + +PKG_INSTALLATION_TYPES= overwrite pkgviews +PKG_DESTDIR_SUPPORT= user-destdir + +DEPENDS= sysbuild>=2.0:../../sysutils/sysbuild + +WRKSRC= ${WRKDIR} +NO_CONFIGURE= YES + +SYSBUILD_USER?= sysbuild +SYSBUILD_GROUP?= sysbuild +SYSBUILD_HOME?= /home/sysbuild + +PKG_GROUPS= ${SYSBUILD_GROUP} +PKG_GROUPS_VARS= PKG_GROUPS +PKG_USERS= ${SYSBUILD_USER}:${SYSBUILD_GROUP} +PKG_USERS_VARS= PKG_USERS + +PKG_GECOS.${SYSBUILD_USER}= Unprivileged user for NetBSD builds +PKG_HOME.${SYSBUILD_USER}= ${SYSBUILD_HOME} +PKG_SHELL.${SYSBUILD_USER}= /bin/sh + +EGDIR= ${PREFIX}/share/examples/sysbuild-user +OWN_DIRS_PERMS= ${SYSBUILD_HOME} ${SYSBUILD_USER} ${SYSBUILD_GROUP} 755 +CONF_FILES= ${EGDIR}/default.conf ${SYSBUILD_HOME}/default.conf + +BUILD_SUBST+= -e 's,@PREFIX@,${PREFIX},g' +FILES_SUBST+= EGDIR=${EGDIR} +FILES_SUBST+= SYSBUILD_HOME=${SYSBUILD_HOME} +FILES_SUBST+= SYSBUILD_USER=${SYSBUILD_USER} +MESSAGE_SUBST+= SYSBUILD_HOME=${SYSBUILD_HOME} +MESSAGE_SUBST+= SYSBUILD_USER=${SYSBUILD_USER} + +INSTALLATION_DIRS= share/examples/sysbuild-user + +do-build: +.for file in crontab default.conf + ${SED} ${BUILD_SUBST} <${FILESDIR}/${file} >${WRKSRC}/${file} +.endfor + +do-install: +.for file in crontab default.conf + ${INSTALL_DATA} ${WRKSRC}/${file} ${DESTDIR}${EGDIR}/ +.endfor + +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/sysbuild-user/PLIST b/sysutils/sysbuild-user/PLIST new file mode 100644 index 00000000000..5c55168e330 --- /dev/null +++ b/sysutils/sysbuild-user/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2012/07/25 12:20:08 jmmv Exp $ +share/examples/sysbuild-user/crontab +share/examples/sysbuild-user/default.conf diff --git a/sysutils/sysbuild-user/files/crontab b/sysutils/sysbuild-user/files/crontab new file mode 100644 index 00000000000..94a09be4eee --- /dev/null +++ b/sysutils/sysbuild-user/files/crontab @@ -0,0 +1,8 @@ +# $NetBSD: crontab,v 1.1 2012/07/25 12:20:08 jmmv Exp $ +# crontab(5) file for the unprivileged sysbuild user. + +PATH=@PREFIX@/bin:@PREFIX@/sbin:/usr/bin:/usr/sbin:/bin:/sbin +SHELL=/bin/sh + +# Cheatsheet: minute hour day-of-month month day-of-week(0,7=Sun) +@daily @PREFIX@/bin/sysbuild4cron -l "${HOME}/log" -- build diff --git a/sysutils/sysbuild-user/files/default.conf b/sysutils/sysbuild-user/files/default.conf new file mode 100644 index 00000000000..bc7a922f918 --- /dev/null +++ b/sysutils/sysbuild-user/files/default.conf @@ -0,0 +1,32 @@ +# $NetBSD: default.conf,v 1.1 2012/07/25 12:20:08 jmmv Exp $ + +# Configuration file for the unprivileged sysbuild user. +# +# Because the unprivileged user's purpose is solely to peform NetBSD +# system builds, we can assume that its home directory is dedicated to +# us and thus can keep a simpler directory layout. + +# Place all files in the user's home directory. +BUILD_ROOT="${HOME}" +RELEASEDIR="${HOME}/release" +SRCDIR="${HOME}/src" +[ ! -f /etc/mtree/set.xbase ] || XSRCDIR="${HOME}/xsrc" + +# Build for the current machine only. +MACHINES="$(uname -m)" + +# What to build for every machine. +BUILD_TARGETS="release" + +# Take advantage of update builds. +INCREMENTAL_BUILD="yes" + +# Set CVS-related settings. +CVSROOT=":ext:anoncvs@anoncvs.NetBSD.org:/cvsroot" +if ! head -n 1 /etc/release | grep 99 >/dev/null; then + CVSTAG="$(head -n 1 /etc/release | cut -d . -f 1 \ + | tr '[A-Z] ' '[a-z]-')" +fi + +# Use as many CPUs as are available. +NJOBS="$(/sbin/sysctl -n hw.ncpuonline)" |