diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-07-24 17:10:57 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-07-24 17:10:57 +0000 |
commit | 1cee61cab57a175608fa153da8f17362ce7f8af4 (patch) | |
tree | 6d99d938e0ca10ccdec46bf68bcefc8fdf264016 /Keywords/sample.ucl | |
parent | ead20185b28fda5ec096aff5a273feb959287940 (diff) | |
download | ports-1cee61cab57a175608fa153da8f17362ce7f8af4.tar.gz ports-1cee61cab57a175608fa153da8f17362ce7f8af4.zip |
Notes
Diffstat (limited to 'Keywords/sample.ucl')
-rw-r--r-- | Keywords/sample.ucl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Keywords/sample.ucl b/Keywords/sample.ucl new file mode 100644 index 000000000000..6c9ac688bd0d --- /dev/null +++ b/Keywords/sample.ucl @@ -0,0 +1,31 @@ +# $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: <<EOD + sample_file="%D/%@" + target_file="${sample_file%.sample}" + if ! [ -f "${target_file}" ]; then + /bin/cp -p "${sample_file}" "${target_file}" + fi +EOD +pre-deinstall: <<EOD + sample_file="%D/%@" + target_file="${sample_file%.sample}" + if cmp -s "${target_file}" "${sample_file}"; then + rm -f "${target_file}" + fi +EOD |