Prune www/mod_extract_forwarded
[dports.git] / Keywords / sample.yaml
1 # $FreeBSD$
2 #
3 # MAINTAINER: portmgr@FreeBSD.org
4 #
5 # @sample etc/somefile.conf.sample
6 #
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
10 # kept.
11 #
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
16
17 actions: [file]
18 post-install: |
19   sample_file="%D/%@"
20   target_file="${sample_file%.sample}"
21   if ! [ -f "${target_file}" ]; then
22     /bin/cp -p "${sample_file}" "${target_file}"
23   fi
24 pre-deinstall: |
25   sample_file="%D/%@"
26   target_file="${sample_file%.sample}"
27   if cmp -s "${target_file}" "${sample_file}"; then
28     rm -f "${target_file}"
29   fi