From 735642e9665348bf391d848653288422a233bbed Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 16 Sep 2024 20:52:53 +0200 Subject: [PATCH] Add debugging --- git-wrapper.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/git-wrapper.sh b/git-wrapper.sh index cf32917..169e1da 100755 --- a/git-wrapper.sh +++ b/git-wrapper.sh @@ -1,5 +1,9 @@ #!/bin/bash +exec >>/tmp/checkout 2>&1 + +echo -e "\n\n+++ $@" + source /git-crypt-vault/env.sh $(dirname $0)/git.bin "$@" @@ -7,11 +11,11 @@ EC=$? if [ "$1" = "checkout" -a -f ".git-crypt-key" -a ! "$GIT_CRYPT_RUNNING" = "true" ]; then export GIT_CRYPT_RUNNING=true - export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="${VAULT_ROLE_ID:-}") + export VAULT_TOKEN=$(HOME=/tmp/githome vault write -field=token auth/approle/login role_id="${VAULT_ROLE_ID}") tmpfile=$(mktemp) - vault read -field=key "secret/git-crypt/$(<.git-crypt-key)" | base64 -d >${tmpfile} - git-crypt unlock ${tmpfile} + HOME=/tmp/githome vault read -field=key "secret/git-crypt/$(<.git-crypt-key)" | base64 -d >${tmpfile} + HOME=/tmp/githome git-crypt unlock ${tmpfile} rm ${tmpfile} fi