mirror of
https://github.com/jakeswenson/BitBetter.git
synced 2025-09-15 06:13:26 +00:00
Improve naming
This commit is contained in:
parent
f9055c711a
commit
a527d425fd
|
@ -1,4 +1,4 @@
|
|||
# Uncomment a line below and fill in the missing values or add your own. Every line in this file will be called by build.[sh|ps1] once the patched image is built.
|
||||
# docker run -d --name bitwarden -v <full-local-path>\logs:/var/log/bitwarden -v <full-local-path>\bwdata:/etc/bitwarden -p 80:8080 --env-file <full-local-path>\settings.env bitwarden-patch
|
||||
# docker run -d --name bitwarden -v <full-local-path>\logs:/var/log/bitwarden -v <full-local-path>\bwdata:/etc/bitwarden -p 80:8080 --env-file <full-local-path>\settings.env bitwarden-patched
|
||||
# <OR>
|
||||
# docker-compose -f <full-local-path>/docker-compose.yml up -d
|
||||
|
|
|
@ -70,7 +70,7 @@ From the BitBetter directory, simply run:
|
|||
./build.[sh|ps1]
|
||||
```
|
||||
|
||||
This will create a new self-signed certificate in the `.keys` directory if one does not already exist and then create a modified version of the official `ghcr.io/bitwarden/self-host` image called `bitwarden-patch`.
|
||||
This will create a new self-signed certificate in the `.keys` directory if one does not already exist and then create a modified version of the official `ghcr.io/bitwarden/self-host` image called `bitwarden-patched`.
|
||||
|
||||
Afterwards it will automatically generate the license generator and start all previously specified containers which are **now ready to accept self-issued licenses.**
|
||||
|
||||
|
|
|
@ -55,12 +55,12 @@ if ($args[0] -eq 'y') {
|
|||
}
|
||||
|
||||
# stop and remove previous existing patch(ed) container
|
||||
$oldinstances = docker container ps --all -f Ancestor=bitwarden-patch --format '{{.ID}}'
|
||||
$oldinstances = docker container ps --all -f Ancestor=bitwarden-patched --format '{{.ID}}'
|
||||
foreach ($instance in $oldinstances) {
|
||||
docker stop $instance
|
||||
docker rm $instance
|
||||
}
|
||||
$oldinstances = docker image ls bitwarden-patch --format '{{.ID}}'
|
||||
$oldinstances = docker image ls bitwarden-patched --format '{{.ID}}'
|
||||
foreach ($instance in $oldinstances) {
|
||||
docker image rm $instance
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ docker rm bitwarden-extract
|
|||
docker run -v "$tempdirectory`:/app/mount" --rm bitbetter/bitbetter
|
||||
|
||||
# create a new image with the patched files
|
||||
docker build . --tag bitwarden-patch --file "$pwd\src\bitBetter\Dockerfile-bitwarden-patch"
|
||||
docker build . --tag bitwarden-patched --file "$pwd\src\bitBetter\Dockerfile-bitwarden-patch"
|
||||
|
||||
# start all user requested instances
|
||||
if (Test-Path -Path "$pwd\.servers\serverlist.txt" -PathType Leaf) {
|
||||
|
|
248
build.sh
248
build.sh
|
@ -1,125 +1,125 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# define temporary directory
|
||||
TEMPDIRECTORY="$PWD/temp"
|
||||
|
||||
# define services to patch
|
||||
COMPONENTS=("Api" "Identity")
|
||||
|
||||
# delete old directories / files if applicable
|
||||
if [ -d "$TEMPDIRECTORY" ]; then
|
||||
rm -rf "$TEMPDIRECTORY"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/licenseGen/Core.dll" ]; then
|
||||
rm -f "$PWD/src/licenseGen/Core.dll"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/licenseGen/cert.pfx" ]; then
|
||||
rm -f "$PWD/src/licenseGen/cert.pfx"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/bitBetter/cert.cert" ]; then
|
||||
rm -f "$PWD/src/bitBetter/cert.cert"
|
||||
fi
|
||||
|
||||
# generate keys if none are available
|
||||
if [ ! -d "$PWD/.keys" ]; then
|
||||
./generateKeys.sh
|
||||
fi
|
||||
|
||||
# copy the key to bitBetter
|
||||
cp -f "$PWD/.keys/cert.cert" "$PWD/src/bitBetter"
|
||||
|
||||
# build bitBetter and clean the source directory after
|
||||
docker build --no-cache -t bitbetter/bitbetter "$PWD/src/bitBetter"
|
||||
rm -f "$PWD/src/bitBetter/cert.cert"
|
||||
|
||||
# gather all running instances
|
||||
OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}')
|
||||
|
||||
# stop and remove all running instances
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
|
||||
# update bitwarden itself
|
||||
if [ "$1" = "update" ]; then
|
||||
docker pull ghcr.io/bitwarden/self-host:beta
|
||||
else
|
||||
read -p "Update (or get) bitwarden source container (y/n): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
docker pull ghcr.io/bitwarden/self-host:beta
|
||||
fi
|
||||
fi
|
||||
|
||||
# stop and remove previous existing patch(ed) container
|
||||
OLDINSTANCES=$(docker container ps --all -f Ancestor=bitwarden-patch --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
OLDINSTANCES=$(docker image ls bitwarden-patch --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker image rm $INSTANCE
|
||||
done
|
||||
|
||||
# remove old extract containers
|
||||
OLDINSTANCES=$(docker container ps --all -f Name=bitwarden-extract --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
|
||||
# start a new bitwarden instance so we can patch it
|
||||
PATCHINSTANCE=$(docker run -d --name bitwarden-extract ghcr.io/bitwarden/self-host:beta)
|
||||
|
||||
# create our temporary directory
|
||||
mkdir $TEMPDIRECTORY
|
||||
|
||||
# extract the files that need to be patched from the services that need to be patched into our temporary directory
|
||||
for COMPONENT in ${COMPONENTS[@]}; do
|
||||
mkdir "$TEMPDIRECTORY/$COMPONENT"
|
||||
docker cp $PATCHINSTANCE:/app/$COMPONENT/Core.dll "$TEMPDIRECTORY/$COMPONENT/Core.dll"
|
||||
done
|
||||
|
||||
# stop and remove our temporary container
|
||||
docker stop bitwarden-extract
|
||||
docker rm bitwarden-extract
|
||||
|
||||
# run bitBetter, this applies our patches to the required files
|
||||
docker run -v "$TEMPDIRECTORY:/app/mount" --rm bitbetter/bitbetter
|
||||
|
||||
# create a new image with the patched files
|
||||
docker build . --tag bitwarden-patch --file "$PWD/src/bitBetter/Dockerfile-bitwarden-patch"
|
||||
|
||||
# start all user requested instances
|
||||
if [ -f "$PWD/src/bitBetter/cert.cert" ]; then
|
||||
sed -i 's/\r$//' "$PWD/.servers/serverlist.txt"
|
||||
cat "$PWD/.servers/serverlist.txt" | while read -r LINE; do
|
||||
if [[ $LINE == "#*" ]]; then
|
||||
bash -c "$LINE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# remove our bitBetter image
|
||||
docker image rm bitbetter/bitbetter
|
||||
|
||||
# copy our patched library to the licenseGen source directory
|
||||
cp -f "$TEMPDIRECTORY/Identity/Core.dll" "$PWD/src/licenseGen"
|
||||
cp -f "$PWD/.keys/cert.pfx" "$PWD/src/licenseGen"
|
||||
|
||||
# build the licenseGen
|
||||
docker build -t bitbetter/licensegen "$PWD/src/licenseGen"
|
||||
|
||||
# clean the licenseGen source directory
|
||||
rm -f "$PWD/src/licenseGen/Core.dll"
|
||||
rm -f "$PWD/src/licenseGen/cert.pfx"
|
||||
|
||||
# remove our temporary directory
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# define temporary directory
|
||||
TEMPDIRECTORY="$PWD/temp"
|
||||
|
||||
# define services to patch
|
||||
COMPONENTS=("Api" "Identity")
|
||||
|
||||
# delete old directories / files if applicable
|
||||
if [ -d "$TEMPDIRECTORY" ]; then
|
||||
rm -rf "$TEMPDIRECTORY"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/licenseGen/Core.dll" ]; then
|
||||
rm -f "$PWD/src/licenseGen/Core.dll"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/licenseGen/cert.pfx" ]; then
|
||||
rm -f "$PWD/src/licenseGen/cert.pfx"
|
||||
fi
|
||||
|
||||
if [ -f "$PWD/src/bitBetter/cert.cert" ]; then
|
||||
rm -f "$PWD/src/bitBetter/cert.cert"
|
||||
fi
|
||||
|
||||
# generate keys if none are available
|
||||
if [ ! -d "$PWD/.keys" ]; then
|
||||
./generateKeys.sh
|
||||
fi
|
||||
|
||||
# copy the key to bitBetter
|
||||
cp -f "$PWD/.keys/cert.cert" "$PWD/src/bitBetter"
|
||||
|
||||
# build bitBetter and clean the source directory after
|
||||
docker build --no-cache -t bitbetter/bitbetter "$PWD/src/bitBetter"
|
||||
rm -f "$PWD/src/bitBetter/cert.cert"
|
||||
|
||||
# gather all running instances
|
||||
OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}')
|
||||
|
||||
# stop and remove all running instances
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
|
||||
# update bitwarden itself
|
||||
if [ "$1" = "update" ]; then
|
||||
docker pull ghcr.io/bitwarden/self-host:beta
|
||||
else
|
||||
read -p "Update (or get) bitwarden source container (y/n): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
docker pull ghcr.io/bitwarden/self-host:beta
|
||||
fi
|
||||
fi
|
||||
|
||||
# stop and remove previous existing patch(ed) container
|
||||
OLDINSTANCES=$(docker container ps --all -f Ancestor=bitwarden-patched --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
OLDINSTANCES=$(docker image ls bitwarden-patched --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker image rm $INSTANCE
|
||||
done
|
||||
|
||||
# remove old extract containers
|
||||
OLDINSTANCES=$(docker container ps --all -f Name=bitwarden-extract --format '{{.ID}}')
|
||||
for INSTANCE in ${OLDINSTANCES[@]}; do
|
||||
docker stop $INSTANCE
|
||||
docker rm $INSTANCE
|
||||
done
|
||||
|
||||
# start a new bitwarden instance so we can patch it
|
||||
PATCHINSTANCE=$(docker run -d --name bitwarden-extract ghcr.io/bitwarden/self-host:beta)
|
||||
|
||||
# create our temporary directory
|
||||
mkdir $TEMPDIRECTORY
|
||||
|
||||
# extract the files that need to be patched from the services that need to be patched into our temporary directory
|
||||
for COMPONENT in ${COMPONENTS[@]}; do
|
||||
mkdir "$TEMPDIRECTORY/$COMPONENT"
|
||||
docker cp $PATCHINSTANCE:/app/$COMPONENT/Core.dll "$TEMPDIRECTORY/$COMPONENT/Core.dll"
|
||||
done
|
||||
|
||||
# stop and remove our temporary container
|
||||
docker stop bitwarden-extract
|
||||
docker rm bitwarden-extract
|
||||
|
||||
# run bitBetter, this applies our patches to the required files
|
||||
docker run -v "$TEMPDIRECTORY:/app/mount" --rm bitbetter/bitbetter
|
||||
|
||||
# create a new image with the patched files
|
||||
docker build . --tag bitwarden-patched --file "$PWD/src/bitBetter/Dockerfile-bitwarden-patch"
|
||||
|
||||
# start all user requested instances
|
||||
if [ -f "$PWD/src/bitBetter/cert.cert" ]; then
|
||||
sed -i 's/\r$//' "$PWD/.servers/serverlist.txt"
|
||||
cat "$PWD/.servers/serverlist.txt" | while read -r LINE; do
|
||||
if [[ $LINE == "#*" ]]; then
|
||||
bash -c "$LINE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# remove our bitBetter image
|
||||
docker image rm bitbetter/bitbetter
|
||||
|
||||
# copy our patched library to the licenseGen source directory
|
||||
cp -f "$TEMPDIRECTORY/Identity/Core.dll" "$PWD/src/licenseGen"
|
||||
cp -f "$PWD/.keys/cert.pfx" "$PWD/src/licenseGen"
|
||||
|
||||
# build the licenseGen
|
||||
docker build -t bitbetter/licensegen "$PWD/src/licenseGen"
|
||||
|
||||
# clean the licenseGen source directory
|
||||
rm -f "$PWD/src/licenseGen/Core.dll"
|
||||
rm -f "$PWD/src/licenseGen/cert.pfx"
|
||||
|
||||
# remove our temporary directory
|
||||
rm -rf "$TEMPDIRECTORY"
|
Loading…
Reference in New Issue
Block a user