Update graphics/kcoloredit to version 2.0.0.4.4.0_5
[dports.git] / Keywords / sample.ucl
1 # $FreeBSD: head/Keywords/sample.ucl 367994 2014-09-11 23:11:48Z bdrewery $
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: <<EOD
19   case "%@" in
20   /*) sample_file="%@" ;;
21   *) sample_file="%D/%@" ;;
22   esac
23   target_file="${sample_file%.sample}"
24   if ! [ -f "${target_file}" ]; then
25     /bin/cp -p "${sample_file}" "${target_file}"
26   fi
27 EOD
28 pre-deinstall: <<EOD
29   case "%@" in
30   /*) sample_file="%@" ;;
31   *) sample_file="%D/%@" ;;
32   esac
33   target_file="${sample_file%.sample}"
34   if cmp -s "${target_file}" "${sample_file}"; then
35     rm -f "${target_file}"
36   else
37     echo "You may need to manually remove ${target_file} if it's no longer needed."
38   fi
39 EOD