dotfiles/.chezmoiscripts/run_before_10-unlock-bw.sh.tmpl

14 lines
290 B
Cheetah
Raw Normal View History

#!/usr/bin/env sh
type bw >/dev/null 2>&1 || exit
pass={{ joinPath .chezmoi.sourceDir ".bw-password.asc" | include | decrypt }}
if ! bw login --check; then
BW_SESSION=$(bw login "bitwarden@punkfairie.net" "$pass" --raw)
else
BW_SESSION=$(bw unlock "$pass" --raw)
fi
export BW_SESSION