bitwarden_rs-debian/build.sh

41 lines
1.0 KiB
Bash
Raw Normal View History

2019-03-26 18:22:31 +01:00
#!/usr/bin/env bash
set -e
2019-03-26 18:37:12 +01:00
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SRC="$DIR/git"
DST="$DIR/dist"
2019-12-02 08:20:50 +01:00
if [ -z "$1" ]; then REF="1.13.0"; else REF="$1"; fi
2019-03-26 18:37:12 +01:00
# Clone bitwarden_rs
2019-03-27 09:54:29 +01:00
if [ ! -d "$SRC" ]; then
2019-03-26 18:37:12 +01:00
git clone https://github.com/dani-garcia/bitwarden_rs.git "$SRC"
2019-03-26 18:22:31 +01:00
fi
2019-03-27 09:54:29 +01:00
cd "$SRC" || exit
2019-09-21 14:38:46 +02:00
CREF="$(git branch | grep \* | cut -d ' ' -f2)"
if [ "$CREF" != "$REF" ]; then
git fetch
git checkout "$REF" --force
else
git clean -d -f
git pull
fi
2019-03-27 09:54:29 +01:00
cd - || exit
# Prepare EnvFile
CONFIG="$DIR/debian/config.env"
cp "$SRC/.env.template" "$CONFIG"
sed -i "s#\# DATA_FOLDER=data#DATA_FOLDER=/var/lib/bitwarden_rs#" "$CONFIG"
sed -i "s#\# WEB_VAULT_FOLDER=web-vault/#WEB_VAULT_FOLDER=/usr/share/bitwarden_rs/web-vault/#" "$CONFIG"
2019-03-26 18:37:12 +01:00
mkdir -p "$DST"
# Prepare Dockerfile
2019-09-21 14:38:46 +02:00
patch -i "$DIR/Dockerfile.patch" "$SRC/docker/amd64/sqlite/Dockerfile" -o "$DIR/Dockerfile" || exit
2019-03-26 18:37:12 +01:00
docker build -t bitwarden-deb "$DIR"
2019-03-26 18:22:31 +01:00
CID=$(docker run -d bitwarden-deb)
2019-03-27 09:54:29 +01:00
docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-$REF.deb"
2019-03-26 18:22:31 +01:00
docker rm "$CID"