From c877192807541368e851239d4c9d2a8c02644ff5 Mon Sep 17 00:00:00 2001 From: LeeW Date: Fri, 31 Jan 2025 14:10:27 +0100 Subject: [PATCH] phase1: update script --- bin/update_sops.sh | 5 ++++- example/cmd_sops.sh | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/update_sops.sh b/bin/update_sops.sh index 22e0ec2..aed72ae 100755 --- a/bin/update_sops.sh +++ b/bin/update_sops.sh @@ -2,7 +2,9 @@ # Purpose: manage .sops.yaml based on gpg keys in the same dir _and_ verify correct configuration set -euo pipefail -sops_config=".sops.yaml" +sops_config_dir="${1?"E: specify dir containing .sops.yaml"}"; shift; +keyfiles_dir="${1?"E: specify dir containing keyfiles"}"; shift; +sops_config="${sops_config_dir}/.sops.yaml" secrets_file="${1:-0}" function fn_extract_fpr(){ @@ -62,6 +64,7 @@ EOM } # UPDATE SOPS CONFIG +pushd "${keyfiles_dir}" (fn_update_sops_config) > "${sops_config}" # VERIFY diff --git a/example/cmd_sops.sh b/example/cmd_sops.sh index 4748246..b44e578 100755 --- a/example/cmd_sops.sh +++ b/example/cmd_sops.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -ueo pipefail -cd "$( dirname "${BASH_SOURCE[0]}")" +curdir="$(realpath $( dirname "${BASH_SOURCE[0]}"))" +cd "$( dirname "${BASH_SOURCE[0]}")/.." -../bin/update_sops.sh +./bin/update_sops.sh "${curdir}" "${PWD}"/