Add support for different Debian versions (#8)
This commit is contained in:
parent
d4e0365a5e
commit
72fc13f80b
@ -16,7 +16,14 @@ Then:
|
||||
```
|
||||
git clone https://github.com/greizgh/bitwarden_rs-debian.git
|
||||
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
|
||||
|
18
build.sh
18
build.sh
@ -5,7 +5,19 @@ set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
SRC="$DIR/git"
|
||||
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
|
||||
if [ ! -d "$SRC" ]; then
|
||||
@ -32,9 +44,11 @@ mkdir -p "$DST"
|
||||
|
||||
# Prepare Dockerfile
|
||||
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"
|
||||
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user