vaultwarden-web/scripts/generate_patch_file.sh
BlackDex aabcc2737f
Update web-vault to v2022.6.0
Updated the web-vault to the latest released version.
This version is also using the new repo `bitwarden/clients` instead of the old `bitwarden/web`.
All files have been changed where needed.
2022-06-29 15:49:38 +02:00

32 lines
930 B
Bash
Executable file

#!/usr/bin/env bash
set -o pipefail -o errexit
BASEDIR=$(dirname "$(readlink -f "$0")")
# Error handling
handle_error() {
read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
exit 1
}
trap 'handle_error $LINENO $?' ERR
# Load default script environment variables
# shellcheck source=.script_env
. "${BASEDIR}/.script_env"
pushd "${VAULT_FOLDER}"
VAULT_VERSION=$(get_web_vault_version)
# Check if the vault versions starts with 20 and isn't a 40 char hash
if [[ ${VAULT_VERSION} = 20* ]] && [ ${#VAULT_VERSION} -ne 40 ]; then
VAULT_VERSION="v${VAULT_VERSION}"
fi
PATCH_FILENAME="${VAULT_VERSION}.patch"
if [ "$(git status --porcelain | wc -l)" -ge 1 ]; then
git --no-pager diff --submodule=diff --no-color --minimal > "../patches/${PATCH_FILENAME}"
echo "Patch has been created here: patches/${PATCH_FILENAME}"
else
echo "No changes found, skip generating a patch file."
fi
popd