diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2014-04-12 03:39:02 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2014-04-12 03:39:02 +0000 |
commit | 4070b125519e180a901b0c14d163885f3c375957 (patch) | |
tree | b5235113da17195fc36663198e7440dd31ce2cc8 /Keywords/sample.yaml | |
parent | 94e8164d5caa4db62a43b41aa03103b9c65dc4cf (diff) | |
download | ports-4070b125519e180a901b0c14d163885f3c375957.tar.gz ports-4070b125519e180a901b0c14d163885f3c375957.zip |
Notes
Diffstat (limited to 'Keywords/sample.yaml')
-rw-r--r-- | Keywords/sample.yaml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Keywords/sample.yaml b/Keywords/sample.yaml new file mode 100644 index 000000000000..4d56793acca1 --- /dev/null +++ b/Keywords/sample.yaml @@ -0,0 +1,29 @@ +# $FreeBSD$ +# +# MAINTAINER: portmgr@FreeBSD.org +# +# @sample etc/somefile.conf.sample +# +# This will install the somefile.conf.sample and automatically copy to +# somefile.conf if it doesn't exist. On deinstall it will remove the +# somefile.conf if it still matches the sample, otherwise it is +# 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] +post-install: | + sample_file="%D/%@" + target_file="${sample_file%.sample}" + if ! [ -f "${target_file}" ]; then + /bin/cp -p "${sample_file}" "${target_file}" + fi +pre-deinstall: | + sample_file="%D/%@" + target_file="${sample_file%.sample}" + if cmp -s "${target_file}" "${sample_file}"; then + rm -f "${target_file}" + fi |