Add support for different Debian versions (#8)

This commit is contained in:
Thomas Meckel 2019-12-02 22:32:28 +01:00 committed by greizgh
parent d4e0365a5e
commit 72fc13f80b
2 changed files with 24 additions and 3 deletions

View File

@ -16,7 +16,14 @@ Then:
``` ```
git clone https://github.com/greizgh/bitwarden_rs-debian.git git clone https://github.com/greizgh/bitwarden_rs-debian.git
cd bitwarden_rs-debian cd bitwarden_rs-debian
./build.sh 1.10.0 ./build.sh -r 1.10.0
```
The `build.sh` script will build bitwarden_rs for the same Debian version which targets bitwarden_rs.
To compile for a different Debian version, specify the release name (e.g. Stretch, Buster) using the `-o` option.
```
./build.sh -o stretch
``` ```
## Post installation ## Post installation

View File

@ -5,7 +5,19 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SRC="$DIR/git" SRC="$DIR/git"
DST="$DIR/dist" DST="$DIR/dist"
if [ -z "$1" ]; then REF="1.13.0"; else REF="$1"; fi
while getopts ":r:o:" opt; do
case $opt in
r) REF="$OPTARG"
;;
o) OS_VERSION_NAME="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
if [ -z "$REF" ]; then REF="1.13.0"; fi
if [ -z "$OS_VERSION_NAME" ]; then OS_VERSION_NAME='buster'; fi
# Clone bitwarden_rs # Clone bitwarden_rs
if [ ! -d "$SRC" ]; then if [ ! -d "$SRC" ]; then
@ -32,9 +44,11 @@ mkdir -p "$DST"
# Prepare Dockerfile # Prepare Dockerfile
patch -i "$DIR/Dockerfile.patch" "$SRC/docker/amd64/sqlite/Dockerfile" -o "$DIR/Dockerfile" || exit patch -i "$DIR/Dockerfile.patch" "$SRC/docker/amd64/sqlite/Dockerfile" -o "$DIR/Dockerfile" || exit
sed -E "s/(FROM[[:space:]]*rust:)[^[:space:]]+(.+)/\1${OS_VERSION_NAME}\2/g" -i "$DIR/Dockerfile"
sed -E "s/(FROM[[:space:]]*debian:)[^-]+(-.+)/\1${OS_VERSION_NAME}\2/g" -i "$DIR/Dockerfile"
docker build -t bitwarden-deb "$DIR" docker build -t bitwarden-deb "$DIR"
CID=$(docker run -d bitwarden-deb) CID=$(docker run -d bitwarden-deb)
docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-$REF.deb" docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-${OS_VERSION_NAME}-${REF}.deb"
docker rm "$CID" docker rm "$CID"