1 # $FreeBSD: head/Keywords/sample.ucl 367994 2014-09-11 23:11:48Z bdrewery $
3 # MAINTAINER: portmgr@FreeBSD.org
5 # @sample etc/somefile.conf.sample
7 # This will install the somefile.conf.sample and automatically copy to
8 # somefile.conf if it doesn't exist. On deinstall it will remove the
9 # somefile.conf if it still matches the sample, otherwise it is
12 # This replaces the old pattern:
13 # @unexec if cmp -s %D/etc/pkgtools.conf %D/etc/pkgtools.conf.sample; then rm -f %D/etc/pkgtools.conf; fi
14 # etc/pkgtools.conf.sample
15 # @exec [ -f %B/pkgtools.conf ] || cp %B/%f %B/pkgtools.conf
20 /*) sample_file="%@" ;;
21 *) sample_file="%D/%@" ;;
23 target_file="${sample_file%.sample}"
24 if ! [ -f "${target_file}" ]; then
25 /bin/cp -p "${sample_file}" "${target_file}"
30 /*) sample_file="%@" ;;
31 *) sample_file="%D/%@" ;;
33 target_file="${sample_file%.sample}"
34 if cmp -s "${target_file}" "${sample_file}"; then
35 rm -f "${target_file}"
37 echo "You may need to manually remove ${target_file} if it's no longer needed."