From 870d2cb3873dd3881169342198c5b8822e35e6db Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 6 Mar 2019 21:05:25 +0100 Subject: mark-as-expendable-dir.in: do not overwrite existing tag files --- mark-as-expendable-dir.in | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/mark-as-expendable-dir.in b/mark-as-expendable-dir.in index e615d3c..bb31b3e 100644 --- a/mark-as-expendable-dir.in +++ b/mark-as-expendable-dir.in @@ -59,20 +59,26 @@ done for dir in "$@" do - { - printf 'Signature: ' - printf '.IsCacheDirectory' | \ - md5sum - | \ - cut -d' ' -f 1 - printf '# This file is a cache directory tag created by %s for %s.\n' \ - "$(basename "$0")" \ - "${caller}" - printf '# For information about cache directory tags, see:\n' - printf '# http://www.brynosaurus.com/cachedir/\n' - } > "${dir}/CACHEDIR.TAG" - { - printf '+ .rsync-filter\n' - printf -- '- *\n' - } > "${dir}/.rsync-filter" - touch "${dir}/.nobackup" + if [ ! -f "${dir}/CACHEDIR.TAG" ]; then + { + printf 'Signature: ' + printf '.IsCacheDirectory' | \ + md5sum - | \ + cut -d' ' -f 1 + printf '# This file is a cache directory tag created by %s for %s.\n' \ + "$(basename "$0")" \ + "${caller}" + printf '# For information about cache directory tags, see:\n' + printf '# http://www.brynosaurus.com/cachedir/\n' + } > "${dir}/CACHEDIR.TAG" + fi + if [ ! -f "${dir}/.rsync-filter" ]; then + { + printf '+ .rsync-filter\n' + printf -- '- *\n' + } > "${dir}/.rsync-filter" + fi + if [ ! -f "${dir}/.nobackup" ]; then + touch "${dir}/.nobackup" + fi done -- cgit v1.2.3-70-g09d2