diff --git a/run_once_install-neovim.sh.tmpl b/run_once_install-neovim.sh.tmpl index c02cc19..ec35cc9 100755 --- a/run_once_install-neovim.sh.tmpl +++ b/run_once_install-neovim.sh.tmpl @@ -33,6 +33,6 @@ else git checkout "${BRANCH}" fi -rm -r build/ +rm -rf ${SRC_DIR}/build make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=${BIN_DIR}" make install diff --git a/run_onchange_before_10-setup-age-key.sh b/run_onchange_before_20-setup-age-key.sh similarity index 55% rename from run_onchange_before_10-setup-age-key.sh rename to run_onchange_before_20-setup-age-key.sh index 6309379..b8c6943 100755 --- a/run_onchange_before_10-setup-age-key.sh +++ b/run_onchange_before_20-setup-age-key.sh @@ -7,12 +7,24 @@ KEY_FILE="$KEY_DIR/key.txt" mkdir -p "$KEY_DIR" chmod 700 "$KEY_DIR" -if (bw status | grep -q '"status": "locked"';) then +VW_URL="https://vault.benq-serv.top" +bw config server "$VW_URL" >/dev/null + +STATUS=$(bw status 2>/dev/null | jq -r '.status') +case "$STATUS" in + "locked") export BW_SESSION=$(bw unlock --raw) -fi + ;; + "unauthenticated") + export BW_SESSION=$(bw login --raw) + ;; + *) + echo "Unknown bw status: $STATUS" + exit 1 + ;; +esac bw sync - bw get item "age-keys" \ | jq -r '.fields[] | select(.name == "private_key") | .value' \ > "$KEY_FILE"