From 82bece2a6d784bea1a4b4d9d8208da378ca1a0c4 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 29 Aug 2016 19:46:37 +0200 Subject: [PATCH] pkg: shadow the sample files, delete on uninstall is undesired While there also get rid of the need for a /usr/ports dir (this will make tools.git crash and burn for sure.) shadow.ucl adapted from https://github.com/freebsd/freebsd-ports/blob/master/Keywords/sample.ucl --- Keywords/shadow.ucl | 54 +++++++++++++++++++ Makefile | 14 +---- Mk/tree.mk | 2 +- .../{FreeBSD.conf => FreeBSD.conf.sample} | 0 4 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 Keywords/shadow.ucl rename src/etc/pkg/repos/{FreeBSD.conf => FreeBSD.conf.sample} (100%) diff --git a/Keywords/shadow.ucl b/Keywords/shadow.ucl new file mode 100644 index 000000000..ea5fa523d --- /dev/null +++ b/Keywords/shadow.ucl @@ -0,0 +1,54 @@ +# $FreeBSD$ +# +# MAINTAINER: franco@opnsense.org +# +# @sample etc/somefile.conf.sample +# or +# @sample file1 file2 +# +# Where file1 is considered as a sample file and file2 the target file +# +# This will install the somefile.conf.sample and automatically copy to +# somefile.conf if it doesn't exist. On deinstall it will be kept. +# +# This replaces the old pattern: +# @unexec if cmp -s %D/etc/pkgtools.conf %D/etc/pkgtools.conf.sample; then rm -f %D/etc/pkgtools.conf; fi +# etc/pkgtools.conf.sample +# @exec [ -f %B/pkgtools.conf ] || cp %B/%f %B/pkgtools.conf + +actions: [file(1)] +arguments: true +post-install: < ${DESTDIR}/+MANIFEST @${MAKE} DESTDIR=${DESTDIR} plist > ${DESTDIR}/plist -package-keywords: force - @if [ ! -f /usr/ports/Keywords/sample.ucl ]; then \ - mkdir -p /usr/ports/Keywords; \ - cd /usr/ports/Keywords; \ - fetch https://raw.githubusercontent.com/opnsense/ports/master/Keywords/sample.ucl; \ - fi - @echo ">>> Installed /usr/ports/Keywords/sample.ucl" - package-check: force @if [ -f ${WRKDIR}/.mount_done ]; then \ echo ">>> Cannot continue with live mount. Please run 'make umount'." >&2; \ exit 1; \ fi - @if [ ! -f /usr/ports/Keywords/sample.ucl ]; then \ - echo ">>> Missing required file(s). Please run 'make package-keywords'" >&2; \ - exit 1; \ - fi package: package-check @rm -rf ${WRKSRC} ${PKGDIR} @${MAKE} DESTDIR=${WRKSRC} FLAVOUR=${FLAVOUR} metadata @${MAKE} DESTDIR=${WRKSRC} FLAVOUR=${FLAVOUR} install - @${PKG} create -v -m ${WRKSRC} -r ${WRKSRC} \ + @PORTSDIR=${.CURDIR} ${PKG} create -v -m ${WRKSRC} -r ${WRKSRC} \ -p ${WRKSRC}/plist -o ${PKGDIR} @echo -n "Successfully built " @cd ${PKGDIR}; find . -name "*.txz" | cut -c3- diff --git a/Mk/tree.mk b/Mk/tree.mk index a89f7d5e3..7a396ae96 100644 --- a/Mk/tree.mk +++ b/Mk/tree.mk @@ -34,7 +34,7 @@ plist${TARGET}: force @(cd ${TREE}; find * -type f ! -name "*.pyc") | while read FILE; do \ FILE="$${FILE%%.in}"; PREFIX=""; \ if [ -z "${NO_SAMPLE}" -a "$${FILE%%.sample}" != "$${FILE}" ]; then \ - PREFIX="@sample "; \ + PREFIX="@shadow "; \ fi; \ if [ -n "${NO_SAMPLE}" ]; then \ FILE="$${FILE%%.sample}"; \ diff --git a/src/etc/pkg/repos/FreeBSD.conf b/src/etc/pkg/repos/FreeBSD.conf.sample similarity index 100% rename from src/etc/pkg/repos/FreeBSD.conf rename to src/etc/pkg/repos/FreeBSD.conf.sample