Update URL with version information (#284)

* Update URL with version information

The previous URL is no longer working. Instead of the site redirect, switching directly to the official GitHub repository of Bitwarden to download the latest version information.

* Update update-bitwarden.sh

* Add prerequisite checks and switch JSON parsing to jq

The URL with the version of self-hosted Bitwarden is not working anymore. Now we're querying the official GitHub repository of Bitwarden and using jq to find the current released version. For simplification, we've moved to jq instead of sed/awk combinations and also added prerequisite checks for docker, openssl, and jq to avoid build failures.

* Add prerequisite checks and switch JSON parsing to jq

The URL with the version of self-hosted Bitwarden is not working anymore. Now we're querying the official GitHub repository of Bitwarden and using jq to find the current released version. For simplification, we've moved to jq instead of sed/awk combinations and also added prerequisite checks for docker, openssl, and jq to avoid build failures. The script was also changed to exit on failure (set -e).

* Update build.sh

Remove duplicate OpenSSL check

* Update update-bitwarden.sh

Remove duplicate OpenSSL check

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: captainhook <16797541+captainhook@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
vdmchkv
2026-06-18 18:51:04 +02:00
committed by GitHub
parent 8def331bb6
commit 314e8e7fb6
2 changed files with 18 additions and 2 deletions

View File

@@ -2,7 +2,15 @@
set -e
DIR=`dirname "$0"`
DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd`
BW_VERSION=$(curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'coreVersion'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
# Check prerequisite libraries and executables
for cmd in docker curl openssl jq; do
command -v "$cmd" >/dev/null 2>&1 || { echo "Error: '$cmd' is required but not installed." >&2; exit 1; }
done
if [ "${BITBETTER_BUILD_FROM_SOURCE:-0}" = "1" ]; then
command -v git >/dev/null 2>&1 || { echo "Error: 'git' is required for BITBETTER_BUILD_FROM_SOURCE=1 but not installed." >&2; exit 1; }
fi
BW_VERSION=$(curl -fsSL https://raw.githubusercontent.com/bitwarden/self-host/refs/heads/main/version.json | jq -er '.versions.coreVersion')
echo "Building BitBetter for BitWarden version $BW_VERSION"

View File

@@ -1,4 +1,6 @@
#!/bin/bash
set -e
ask () {
local __resultVar=$1
local __result="$2"
@@ -9,7 +11,13 @@ ask () {
}
SCRIPT_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BW_VERSION=$(curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'coreVersion'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
# Check prerequisite libraries and executables
for cmd in docker curl openssl jq; do
command -v "$cmd" >/dev/null 2>&1 || { echo "Error: '$cmd' is required but not installed." >&2; exit 1; }
done
BW_VERSION=$(curl -fsSL https://raw.githubusercontent.com/bitwarden/self-host/refs/heads/main/version.json | jq -er '.versions.coreVersion')
echo "Starting Bitwarden update, newest server version: $BW_VERSION"