%define debug_package %{nil} Name: vaultwarden-postgresql Version: 1.32.1 Release: 1%{?dist} Summary: Unofficial Bitwarden compatible server written in Rust (PostgreSQL backend) License: GPL-3.0-only URL: https://github.com/dani-garcia/vaultwarden Provides: vaultwarden = %{version} Conflicts: vaultwarden-mysql Conflicts: vaultwarden-sqlite Source0: https://github.com/dani-garcia/vaultwarden/archive/%{version}.tar.gz Source1: vaultwarden.service Source2: vaultwarden.sysusers Patch0: config.patch BuildRequires: curl BuildRequires: pkgconfig(libpq) BuildRequires: pkgconfig(openssl) BuildRequires: systemd BuildRequires: systemd-rpm-macros BuildRequires: /usr/bin/cc Requires: vaultwarden-web %description A Bitwarden server API implementation written in Rust compatible with upstream Bitwarden clients. This version uses PostgreSQL as its backend. %prep %setup -qn vaultwarden-%{version} %patch -P 0 -p1 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y %build source "$HOME/.cargo/env" cargo build --features postgresql --release %install install -d %{buildroot}%{_localstatedir}/log/vaultwarden install -Dpm 755 target/release/vaultwarden %{buildroot}%{_bindir}/vaultwarden install -Dpm 644 %{SOURCE1} %{buildroot}%{_unitdir}/vaultwarden.service cp %{buildroot}%{_unitdir}/vaultwarden.service %{buildroot}%{_unitdir}/vaultwarden-waitforpostgresql.service sed -i "s/After=network.target/After=network.target postgresql.service/" %{buildroot}%{_unitdir}/vaultwarden-waitforpostgresql.service install -Dpm 644 .env.template %{buildroot}%{_sysconfdir}/vaultwarden/config.env install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/vaultwarden.conf %files %license LICENSE.txt %{_bindir}/vaultwarden %{_unitdir}/vaultwarden.service %{_unitdir}/vaultwarden-waitforpostgresql.service %config(noreplace) %{_sysconfdir}/vaultwarden/config.env %{_sysusersdir}/vaultwarden.conf %pre %if 0%{?fedora} %sysusers_create_compat %{SOURCE2} %else getent group vaultwarden > /dev/null || groupadd -r vaultwarden getent passwd vaultwarden > /dev/null || useradd -M -r -g vaultwarden -c "Vaultwarden User" -s /sbin/nologin vaultwarden %endif