diff options
author | Erich Eckner <git@eckner.net> | 2019-03-06 21:05:25 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-03-18 19:48:45 +0100 |
commit | 870d2cb3873dd3881169342198c5b8822e35e6db (patch) | |
tree | 83ab40866117c5a983a8e24c02d0ac37675bac4c | |
parent | 78a0a598c432a12454e2ab664d7e08c9a50ff791 (diff) | |
download | mark-as-expendable-dir-870d2cb3873dd3881169342198c5b8822e35e6db.tar.xz |
mark-as-expendable-dir.in: do not overwrite existing tag files
-rw-r--r-- | mark-as-expendable-dir.in | 38 |
1 files 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 |