From 171c30e79fe34ce2dcf411b9db0f9cf64616a0c7 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Wed, 2 Sep 2026 19:08:01 +0530 Subject: feat(security/gopass): auto initialize git sync repo for gopass on build --- modules/security/gopass/gopass-sync-init.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 modules/security/gopass/gopass-sync-init.sh (limited to 'modules/security/gopass/gopass-sync-init.sh') diff --git a/modules/security/gopass/gopass-sync-init.sh b/modules/security/gopass/gopass-sync-init.sh new file mode 100644 index 0000000..6fe4f8a --- /dev/null +++ b/modules/security/gopass/gopass-sync-init.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +STORE_DIR="@@PASSWORD_STORE_DIR@@" + +mkdir -p "$STORE_DIR" +cd "$STORE_DIR" || { echo "Failed to enter $STORE_DIR"; exit 1; } + +# Check if the directory is already a git repository; initialize if not +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "Initializing git repository in $STORE_DIR..." + git init +fi + +# Check if the remote 'origin' is set; add it if not +if ! git remote | grep -q "^origin$"; then + echo "Adding remote origin..." + git remote add origin "@@REMOTE_REPO_URL@@" +fi + +echo "Password store git setup complete." -- cgit v1.2.3