From 9b23b3686068d41642f0a3e0b5417830141a58b3 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Sat, 9 Mar 2024 08:46:13 +0100 Subject: [PATCH] make it work with docker --- scripts/apply_patches.sh | 16 ++++++++++++++-- scripts/replace-embedded-svg-icons.sh | 20 -------------------- 2 files changed, 14 insertions(+), 22 deletions(-) delete mode 100755 scripts/replace-embedded-svg-icons.sh diff --git a/scripts/apply_patches.sh b/scripts/apply_patches.sh index 4deaf7b..f7c92d3 100755 --- a/scripts/apply_patches.sh +++ b/scripts/apply_patches.sh @@ -1,6 +1,18 @@ #!/usr/bin/env bash set -o pipefail -o errexit +function replace_embedded_svg_icon() { +if [ ! -f $1 ]; then echo "$1 does not exist"; exit -1; fi +if [ ! -f $2 ]; then echo "$2 does not exist"; exit -1; fi + +echo "'$1' -> '$2'" + +first='`$' +last='^`' +sed -i "/$first/,/$last/{ /$first/{p; r $1 +}; /$last/p; d }" $2 +} + # If a patch was not provided, try to choose one if [[ -z ${PATCH_NAME} ]]; then # If a patch with the same name as the ref exists, use it @@ -30,10 +42,10 @@ echo "Patching images" cp -vfR ../resources/src/* ./apps/web/src/ echo "Patching logos" -../scripts/replace-embedded-svg-icons.sh \ +replace_embedded_svg_icon \ ../resources/vaultwarden-admin-console-logo.svg \ ./apps/web/src/app/admin-console/icons/admin-console-logo.ts -../scripts/replace-embedded-svg-icons.sh \ +replace_embedded_svg_icon \ ../resources/vaultwarden-password-manager-logo.svg \ ./apps/web/src/app/layouts/password-manager-logo.ts diff --git a/scripts/replace-embedded-svg-icons.sh b/scripts/replace-embedded-svg-icons.sh deleted file mode 100755 index b1cad6d..0000000 --- a/scripts/replace-embedded-svg-icons.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -if [ ! -f $1 ] -then - echo "$1 does not exist" - exit -1 -fi - -if [ ! -f $2 ] -then - echo "$2 does not exist" - exit -1 -fi - -echo "'$1' -> '$2'" - -first='`$' -last='^`' -sed -i "/$first/,/$last/{ /$first/{p; r $1 -}; /$last/p; d }" $2