-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fa0d81
commit 7e2de9f
Showing
3 changed files
with
98 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# [[file:../../../workstation.org::*Initial Bitwarden Sync][Initial Bitwarden Sync:2]] | ||
# The initial BitWarden Sync process. Requires wshs/bww executable to | ||
# be built and available. This could all be more robust | ||
# extracting it is theoretically useful as it provides a mechanism for | ||
# resetting the secrets. | ||
# Likely this should be broken down into separate functions that can be reused. | ||
function initial_bitwarden_sync() { | ||
# why is bash so cryptic | ||
if [ ! -z "${BW_CLIENTID+x}" ] && \ | ||
[ ! -z "${BW_CLIENTSECRET+x}" ] && \ | ||
[ ! -z "${WS_BW_MASTER_PASS+x}" ]; then | ||
info variables requried to run bww force-sync are set, running | ||
if [ ! -d ~/secrets ]; then | ||
mkdir ~/secrets; | ||
fi | ||
# overwriting anything that was previously in the file | ||
echo "${WS_BW_MASTER_PASS}" > ~/secrets/bw_pass | ||
bw login --apikey | ||
bw_unlock | ||
bw sync | ||
$(nix path-info .#"wshs:exe:bww")/bin/bww force-sync | ||
else | ||
info variables required to run bww force sync are MISSING, skipping | ||
fi | ||
} | ||
initial_bitwarden_sync | ||
# Initial Bitwarden Sync:2 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters