diff --git a/homelab/.sops/decrypt-filter.sh b/homelab/.sops/decrypt-filter.sh index e5d8229e..fadc1942 100755 --- a/homelab/.sops/decrypt-filter.sh +++ b/homelab/.sops/decrypt-filter.sh @@ -2,6 +2,12 @@ # Takes file path from stdin # Outputs to stdout +if ! [[ -f $1 ]]; then + echo "\$1 is not a file" + echo "\$1: $1" + exit 1 +fi + # Set age key file path # If no private key exists at the expected location, # Create the key file at the expected location diff --git a/homelab/.sops/encrypt-filter.sh b/homelab/.sops/encrypt-filter.sh index b0451399..ad691a10 100755 --- a/homelab/.sops/encrypt-filter.sh +++ b/homelab/.sops/encrypt-filter.sh @@ -2,6 +2,12 @@ # Takes file path from stdin # Outputs to stdout +if ! [[ -f $1 ]]; then + echo "\$1 is not a file" + echo "\$1: $1" + exit 1 +fi + # Set age directory and default recipients AGE_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) SOPS_AGE_RECIPIENTS="$(<$AGE_DIR/.age-author-pubkeys)"