mirror of
https://github.com/lucaspalomodevelop/opnsense-core.git
synced 2026-03-13 00:07:27 +00:00
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
This commit is contained in:
parent
a0664f1116
commit
82bece2a6d
54
Keywords/shadow.ucl
Normal file
54
Keywords/shadow.ucl
Normal file
@ -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: <<EOD
|
||||
case "%1" in
|
||||
/*) sample_file="%1" ;;
|
||||
*) sample_file="%D/%1" ;;
|
||||
esac
|
||||
target_file="${sample_file%.sample}"
|
||||
set -- %@
|
||||
if [ $# -eq 2 ]; then
|
||||
target_file=${2}
|
||||
fi
|
||||
case "${target_file}" in
|
||||
/*) target_file="${target_file}" ;;
|
||||
*) target_file="%D/${target_file}" ;;
|
||||
esac
|
||||
if ! [ -f "${target_file}" ]; then
|
||||
/bin/cp -p "${sample_file}" "${target_file}"
|
||||
fi
|
||||
EOD
|
||||
pre-deinstall: <<EOD
|
||||
case "%1" in
|
||||
/*) sample_file="%1" ;;
|
||||
*) sample_file="%D/%1" ;;
|
||||
esac
|
||||
target_file="${sample_file%.sample}"
|
||||
set -- %@
|
||||
if [ $# -eq 2 ]; then
|
||||
set -- %@
|
||||
target_file=${2}
|
||||
fi
|
||||
case "${target_file}" in
|
||||
/*) target_file="${target_file}" ;;
|
||||
*) target_file="%D/${target_file}" ;;
|
||||
esac
|
||||
EOD
|
||||
14
Makefile
14
Makefile
@ -235,29 +235,17 @@ metadata: force
|
||||
@${MAKE} DESTDIR=${DESTDIR} manifest > ${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-
|
||||
|
||||
@ -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}"; \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user