diff options
| author | Anton Bobov <anton@bobov.name> | 2025-08-01 09:32:03 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2025-08-01 09:32:03 +0500 |
| commit | 28787c7659b3a5b9cf9cfb2fa6b1563a168bdbc8 (patch) | |
| tree | 4246d26d09ef8931eff69ae0912d25541cb81a68 | |
| parent | 0698299331a0be015b0854da6c10bdfbce31697d (diff) | |
Add script to create CACHEDIR.TAG file
Useful to mark directory as a cache for other tools (ex. restic).
| -rwxr-xr-x | cache-tag-this-dir | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cache-tag-this-dir b/cache-tag-this-dir new file mode 100755 index 0000000..0dad1c8 --- /dev/null +++ b/cache-tag-this-dir @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +TAG_FILE_NAME=CACHEDIR.TAG + +if [ -f "$TAG_FILE_NAME" ]; then + echo "File $TAG_FILE_NAME already exists, skipping any action." +else + COMMENT="user $USER" + cat <<EOF >"$TAG_FILE_NAME" +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by $COMMENT. +# For information about cache directory tags, see: https://bford.info/cachedir/ +EOF +fi |
