macos/exclude_from_backblaze
7 echo "Usage: $0 <path_to_directory>" >
&2
12BZCLI_PATH="/Applications/Backblaze.app/Contents/MacOS/bzcli"
14# If Backblaze isn't installed, we can assume this device isn't backed
15# up with Backblaze and no-op this operation.
16if [ ! -x
"$BZCLI_PATH" ]; then
20# Resolve relative paths to absolute paths.
21if [[ "$INPUT_PATH" = /*
]]; then
22 TARGET_DIR="$INPUT_PATH"
24 TARGET_DIR="$PWD/$INPUT_PATH"
27# Create a temporary JSON file with the following structure:
33# "dir": "/Users/alexwlchan/repos/chives/.venv/",
41trap 'rm -f "$TEMP_JSON"' EXIT
44 --arg dir
"$TARGET_DIR" \
45 '{settings: {bzdirfilter_add: [{dir: $dir, whichfiles: "none"}]}}' \
47 echo "Error: Failed to generate temporary JSON configuration." >
&2
51echo "Applying Backblaze exclusion for: $TARGET_DIR"
53if !
"$BZCLI_PATH" configure -j
"$TEMP_JSON"; then
54 echo "Error: bzcli configuration failed." >
&2