chore: use non-snap version for bw

This commit is contained in:
Stevan Freeborn
2026-07-07 19:51:17 -05:00
parent 69800aea62
commit 37bba6dd1f
2 changed files with 22 additions and 27 deletions
+20 -25
View File
@@ -37,34 +37,29 @@ else
fi fi
# --- Install Bitwarden CLI --- # --- Install Bitwarden CLI ---
# Ensure /snap/bin is in PATH — snap binaries aren't visible in the current
# shell session without this when running via bash <(curl ...)
command -v snap &>/dev/null && export PATH="$PATH:/snap/bin"
step "Checking Bitwarden CLI..." step "Checking Bitwarden CLI..."
if command -v bw &>/dev/null; then if BW_VERSION=$(bw --version 2>/dev/null); then
skip "bw already installed ($(bw --version))." skip "bw already installed ($BW_VERSION)."
else else
if command -v snap &>/dev/null; then # Remove broken snap installation if present
step "Installing Bitwarden CLI via snap..." if command -v snap &>/dev/null && snap list bw &>/dev/null 2>&1; then
sudo snap install bw echo " Removing broken snap installation..."
ok "bw installed via snap." sudo snap remove bw
else
# Fallback: download the official Linux binary from GitHub releases
step "snap not available; downloading Bitwarden CLI binary..."
BW_VERSION=$(curl -fsLS "https://api.github.com/repos/bitwarden/clients/releases/latest" \
| grep '"tag_name"' | grep cli | head -1 | sed 's/.*"cli-v\([^"]*\)".*/\1/' || echo "")
if [ -z "$BW_VERSION" ]; then
err "Could not determine latest Bitwarden CLI version. Install bw manually and re-run."
fi
TMP_ZIP=$(mktemp /tmp/bw-XXXXXX.zip)
curl -fsLS "https://github.com/bitwarden/clients/releases/download/cli-v${BW_VERSION}/bw-linux-${BW_VERSION}.zip" \
-o "$TMP_ZIP"
sudo unzip -o "$TMP_ZIP" -d /usr/local/bin/ bw
sudo chmod +x /usr/local/bin/bw
rm -f "$TMP_ZIP"
ok "bw ${BW_VERSION} installed to /usr/local/bin/bw."
fi fi
step "Downloading Bitwarden CLI binary..."
BW_VERSION=$(curl -fsLS "https://api.github.com/repos/bitwarden/clients/releases/latest" \
| grep '"tag_name"' | grep cli | head -1 | sed 's/.*"cli-v\([^"]*\)".*/\1/' || echo "")
if [ -z "$BW_VERSION" ]; then
err "Could not determine latest Bitwarden CLI version. Install bw manually and re-run."
fi
TMP_ZIP=$(mktemp /tmp/bw-XXXXXX.zip)
curl -fsLS "https://github.com/bitwarden/clients/releases/download/cli-v${BW_VERSION}/bw-linux-${BW_VERSION}.zip" \
-o "$TMP_ZIP"
sudo unzip -o "$TMP_ZIP" -d /usr/local/bin/ bw
sudo chmod +x /usr/local/bin/bw
rm -f "$TMP_ZIP"
ok "bw ${BW_VERSION} installed to /usr/local/bin/bw."
fi fi
# --- Install chezmoi --- # --- Install chezmoi ---
+2 -2
View File
@@ -7,7 +7,7 @@
# Public keys (.pub files) and non-key files (config, known_hosts) are skipped. # Public keys (.pub files) and non-key files (config, known_hosts) are skipped.
# #
# Requires: # Requires:
# - Bitwarden CLI (bw) — install via: sudo snap install bw # - Bitwarden CLI (bw) — install via the bootstrap script or download the Linux binary from GitHub
# - jq — install via: sudo apt install jq # - jq — install via: sudo apt install jq
# - BW_SESSION environment variable set # - BW_SESSION environment variable set
# #
@@ -33,7 +33,7 @@ done
# --- Preflight checks --- # --- Preflight checks ---
if ! command -v bw &>/dev/null; then if ! command -v bw &>/dev/null; then
echo "Bitwarden CLI (bw) not found. Install it with: sudo snap install bw" >&2 echo "Bitwarden CLI (bw) not found. Run the bootstrap script or download the Linux binary from GitHub." >&2
exit 1 exit 1
fi fi