view Makefile @ 437:59622f32279d

Add two examples of how to use ftjail and friends to (freebsd-)update a thin jail. 1. Update the thin jail template 2. Update the thin jails These scripts are not yet polished. They are added as used for some times when managing jails.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 01 May 2024 20:58:54 +0200
parents 4da3377f4139
children b5e45ecd4032
line wrap: on
line source

# Created by: Franz Glasner <freebsd-dev@dom66.de>

PORTNAME=	local-bsdtools
PORTVERSION=	0.25
CATEGORIES=	sysutils
MASTER_SITES=	# none
DISTFILES=	# none

MAINTAINER=	freebsd-dev@dom66.de
COMMENT=	Collection of private system management tools

LICENSE=	BSD3CLAUSE

EXTRACT_DEPENDS=	hg:devel/mercurial
RUN_DEPENDS=		pkg:ports-mgmt/pkg

NO_ARCH=	yes
WRKSRC=		${WRKDIR}/local-bsdtools

OPTIONS_DEFINE=	DOCS
OPTIONS_SUB=	yes

DOCS_BUILD_DEPENDS=	sphinx-build:textproc/py-sphinx
DOCS_VARS_OFF=		NO_BUILD=yes

.include <bsd.port.options.mk>

SRC=		${.CURDIR}

MANPAGES5=	${:!${LS} -1 "${.CURDIR}/docs/man/man5"!}
MANPAGES8=	${:!${LS} -1 "${.CURDIR}/docs/man/man8"!}

HGCANONICALPATH?=	default
HGREVISION=	${:!hg id -R "${SRC}" -q!}
HGDATE=		${:!hg log -R "${SRC}" -r "${HGREVISION:S/+//}" --template '{date|isodatesec}'!}
HGAUTHOR=	${:!hg log -R "${SRC}" -r "${HGREVISION:S/+//}" --template '{author|person}' | ${TR} ' ' '+'!}
HGPATH=		${:!hg --config ui.paginate=never path -R "${SRC}" ${HGCANONICALPATH} || echo "file://\$$\(hg root)"!}
HGPHASE=	${:!hg phase!:[2]}
SIMPLEVERSIONSTR=	v${PKGVERSION} (rv:${HGREVISION})
SIMPLEVERSIONTAG=	${PKGORIGIN} v${PKGVERSION} (rv:${HGREVISION})
VERSIONTAG=	${PKGORIGIN} v${PKGVERSION} (rv:${HGREVISION} with repo at ${HGPATH})

do-extract:
	${MKDIR} ${WRKSRC}/bin
	${MKDIR} ${WRKSRC}/sbin
	${CP} Makefile ${WRKSRC}/Makefile
.for _rp in sbin/check-ports sbin/fjail sbin/ftjail sbin/fzfs sbin/fpkg sbin/bsmtp2dma
	${CP} -v ${SRC}/${_rp} ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@VERSION@@|${PORTVERSION}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@ETCDIR@@|${ETCDIR}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@VERSIONTAG@@|${VERSIONTAG}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@SIMPLEVERSIONTAG@@|${SIMPLEVERSIONTAG}|" ${WRKSRC}/${_rp}
	${SED} -i "" -e "s|@@SIMPLEVERSIONSTR@@|${SIMPLEVERSIONSTR}|" ${WRKSRC}/${_rp}
.endfor
	${MKDIR} ${WRKSRC}/etc/periodic/daily
.for _ef in etc/package-mapping.conf.sample etc/pkgtools.conf.sample etc/bsmtp2dma.conf.sample etc/periodic/daily/800.local-ipv6-refresh etc/periodic/daily/750.local-trim-zfs etc/periodic/daily/720.local-triggered-action
	${CP} -v ${SRC}/${_ef} ${WRKSRC}/${_ef}
	${SED} -i "" -e "s|@@SIMPLEVERSIONTAG@@|${SIMPLEVERSIONTAG}|" ${WRKSRC}/${_ef}
.endfor

post-extract-DOCS-on:
	${MKDIR} ${WRKSRC}/docs
	(${TAR} -C ${.CURDIR}/docs -c --exclude ./_build -f - . | ${TAR} -C ${WRKSRC}/docs -x -f - )
.for _mp in man/man8/local-bsdtools.rst
	${SED} -i "" -e "s|@@SIMPLEVERSIONTAG@@|${SIMPLEVERSIONTAG}|" ${WRKSRC}/docs/${_mp}
	${SED} -i "" -e "s|\\\$$HGid\\\$$|\$$HGid: ${HGPATH}/docs/${_mp} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/docs/${_mp}
.endfor

.if ${PORT_OPTIONS:MDOCS}
do-build:
	(cd ${WRKSRC}/docs && sphinx-build -M man . _build)
	(cd ${WRKSRC}/docs && sphinx-build -M html . _build)
.endif

do-install:
.for _rp in sbin/check-ports sbin/fjail sbin/ftjail sbin/fzfs sbin/fpkg sbin/bsmtp2dma
	${INSTALL_SCRIPT} ${WRKSRC}/${_rp} ${STAGEDIR}${PREFIX}/${_rp}
.endfor
	${MKDIR} ${STAGEDIR}${ETCDIR}
.for _ef in package-mapping.conf.sample pkgtools.conf.sample bsmtp2dma.conf.sample
	${INSTALL_DATA} ${WRKSRC}/etc/${_ef} ${STAGEDIR}${ETCDIR}/${_ef}
.endfor
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily
.for _ps in 800.local-ipv6-refresh 750.local-trim-zfs 720.local-triggered-action
	${INSTALL_SCRIPT} ${WRKSRC}/etc/periodic/daily/${_ps} ${STAGEDIR}${PREFIX}/etc/periodic/daily
.endfor

post-install-DOCS-on:
.for _mp in ${MANPAGES5:R}
	${INSTALL_DATA} ${WRKSRC}/docs/_build/man/${_mp}.5 ${STAGEDIR}${PREFIX}/man/man5/${_mp}.5
.endfor
.for _mp in ${MANPAGES8:R}
	${INSTALL_DATA} ${WRKSRC}/docs/_build/man/${_mp}.8 ${STAGEDIR}${PREFIX}/man/man8/${_mp}.8
.endfor

.include <bsd.port.mk>