From 892fbc2039b2218a3528753851311b2e36d6dcd2 Mon Sep 17 00:00:00 2001 From: LeeW Date: Mon, 17 Feb 2025 13:11:41 +0100 Subject: [PATCH] fix: iterate fix for sops.yaml not created in specified config dir - fixed! --- bin/update_sops.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/update_sops.sh b/bin/update_sops.sh index 425d4a4..da368a0 100755 --- a/bin/update_sops.sh +++ b/bin/update_sops.sh @@ -170,17 +170,16 @@ function main(){ # VALIDATE INPUTS keyfiles_dir="$(realpath "${keyfiles_dir}")" test -d "${keyfiles_dir}" || (echo "E: specify dir containing keyfiles; invalid dir: '${keyfiles_dir}'" && exit 1) + # define sops config location sops_config="" if [[ -n "${sops_config_dir:-}" ]]; then + # user-specified sops_config_dir="$(realpath "${sops_config_dir}")" + # vvv possibly redundant, since the 'realpath' will fail if dir not valid test -d "${sops_config_dir}" || (echo "E: specify dir containing .sops.yaml, invalid dir: '${sops_config_dir}'" && exit 1) sops_config="${sops_config_dir}/.sops.yaml" - set -x - touch "${sops_config}" - fi - - # locate appropriate sops config if default assumption not found - if [[ ! -e "${sops_config}" ]]; then + else + # locate appropriate sops config if default assumption not found # dev note: '2> /dev/null' to disable debug output sops_config="$(fn_sops_locate_config_in_git_repo 2> /dev/null)" fi