Support for arm32v7 (#25)

* Move Dockerfile.patch files to architecture dependent directories

Need a way to distinguish between patches when we implement support for other architectures.
Putting them in different paths seems simple and straight forward enough.

* Add -a option to support arm32v7 and amd64 architectures

Previous releases lacked support for compiling for arm32v7 architecture.
In order to keep previous behaviour the default is set to amd64. Using the
-a option, users can now choose between arm32v7 and amd64. If arm32v7 is
used only the Buster release of debian is supported. The limitation is
due to the libmariadb3:armhf dependency not being avaliable in earlier
debian releases.

* Update documentation to detail the -a option

* Remove reference to local dirs

* Set debian package to report correct architecture for arm32v7 build

* Format arm32v7 Dockerfile.patch to match the amd64

* Handle architecture property in control file dynamically

Similar to version, the architecture property in the control file should be
handled dynamically. The build script will now replace the architecture prop
from control.dist to match the choosen architecture.
This commit is contained in:
Christian Eriksson
2020-11-10 11:08:37 +01:00
committed by GitHub
parent 9d735d0a99
commit 9989534983
5 changed files with 128 additions and 6 deletions
+9 -3
View File
@@ -6,7 +6,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SRC="$DIR/git"
DST="$DIR/dist"
while getopts ":r:o:d:" opt; do
while getopts ":r:o:d:a:" opt; do
case $opt in
r) REF="$OPTARG"
;;
@@ -14,6 +14,8 @@ while getopts ":r:o:d:" opt; do
;;
d) DB_TYPE="$OPTARG"
;;
a) ARCH_DIR="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
@@ -21,6 +23,9 @@ done
if [ -z "$REF" ]; then REF=$(curl -s https://api.github.com/repos/dani-garcia/bitwarden_rs/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 1-); fi
if [ -z "$OS_VERSION_NAME" ]; then OS_VERSION_NAME='buster'; fi
if [ -z "$DB_TYPE" ]; then DB_TYPE="sqlite"; fi
if [ -z "$ARCH_DIR" ]; then ARCH_DIR="amd64"; fi
ARCH=$ARCH_DIR
if [[ "$ARCH" =~ ^arm ]]; then ARCH="armhf"; fi
# Clone bitwarden_rs
if [ ! -d "$SRC" ]; then
@@ -47,7 +52,7 @@ sed -i "s/Uncomment any of the following lines to change the defaults/Uncomment
mkdir -p "$DST"
# Prepare Dockerfile
patch -i "$DIR/Dockerfile.patch" "$SRC/docker/amd64/Dockerfile" --verbose -o "$DIR/Dockerfile" || exit
patch -i "$DIR/patch/$ARCH_DIR/Dockerfile.patch" "$SRC/docker/$ARCH_DIR/Dockerfile" --verbose -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"
@@ -55,6 +60,7 @@ sed -E "s/(FROM[[:space:]]*debian:)[^-]+(-.+)/\1${OS_VERSION_NAME}\2/g" -i "$DIR
CONTROL="$DIR/debian/control"
cp "$DIR/control.dist" "$CONTROL"
sed -i "s/Version:.*/Version: $REF-1/" "$CONTROL"
sed -i "s/Architecture:.*/Architecture: $ARCH/" "$CONTROL"
# Prepare Systemd-unit
SYSTEMD_UNIT="$DIR/debian/bitwarden_rs.service"
@@ -68,5 +74,5 @@ echo "[INFO] docker build -t bitwarden-deb "$DIR" --build-arg DB=$DB_TYPE"
docker build -t bitwarden-deb "$DIR" --build-arg DB=$DB_TYPE
CID=$(docker run -d bitwarden-deb)
docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-${OS_VERSION_NAME}-${REF}-${DB_TYPE}.deb"
docker cp "$CID":/bitwarden_package/bitwarden-rs.deb "$DST/bitwarden_rs-${OS_VERSION_NAME}-${REF}-${DB_TYPE}-${ARCH_DIR}.deb"
docker rm "$CID"