debmaker/ressources/vaultwarden/debmaker

43 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=vaultwarden
VERSION=1.25.0
GIT_VERSION=$VERSION
DEB_VERSION=$VERSION-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=8
DEPOT=https://github.com/dani-garcia/vaultwarden.git
STEP="envinit prebuild build makedeb"
envinit() {
apt-get update
apt-get dist-upgrade -y
apt install -y --no-install-recommends build-essential git wget fakeroot dpkg ca-certificates libmariadb-dev libpq-dev pkg-config libmysql++-dev
cd /tmp
wget -qO - https://sh.rustup.rs > rustup
bash rustup -qy
apt clean
}
prebuild(){
[ -e /tmp/${APP} ] && rm -fr /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP}
}
build() {
cd /tmp/${APP}
source ~/.cargo/env
cargo build --features sqlite,mysql,postgresql --release
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp -fr /tmp/${APP}/target/release/vaultwarden ${PATH_DEB}/usr/lib/vaultwarden/
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}