# Generated by rust2rpm 26 %bcond_without check %bcond_without vendor # prevent library files from being installed %global cargo_install_lib 0 Name: vaultwarden Version: 1.30.5 Release: 1%{?dist} Summary: Unofficial Bitwarden compatible server License: AGPL-3.0-only AND (Apache-2.0 OR MIT) AND BSD-3-Clause AND 0BSD AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND (BSD-3-Clause OR MIT) AND ISC AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR Zlib) AND (MIT OR Zlib OR Apache-2.0) AND MPL-2.0 AND (Unlicense OR MIT) AND (Zlib OR Apache-2.0 OR MIT) AND (ISC AND MIT AND OpenSSL) # LICENSE.dependencies contains a full license breakdown URL: https://github.com/dani-garcia/vaultwarden Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source1: vaultwarden-%{version}-vendor.tar.xz Source2: vaultwarden.service Source3: vaultwarden.sysconfig Source4: vaultwarden.cfg Source5: vaultwarden.sysusers BuildRequires: cargo-rpm-macros >= 26 BuildRequires: openssl-devel BuildRequires: mariadb-devel BuildRequires: libpq-devel BuildRequires: systemd-rpm-macros Requires: %{name}-web %{?sysusers_requires_compat} %global _description %{expand: %{summary}.} %description %{_description} %prep %if %{with vendor} %autosetup -n %{name}-%{version} -p1 -a1 %cargo_prep -v vendor %else %autosetup -n %{name}-%{version} -p1 %cargo_prep %generate_buildrequires %cargo_generate_buildrequires %endif # ring doesn't specify a license at all, should be "ISC AND MIT AND OpenSSL" # determined in https://bugzilla.redhat.com/show_bug.cgi?id=2269411#c8 # if a license spec is added upstream in an update lets fail out so we don't miss it if grep -q 'license =' vendor/ring-*/Cargo.toml; then echo "License specification found in ring crate. Please review." exit 1 else sed -i '/\[package\]/a license = "ISC AND MIT AND OpenSSL"' vendor/ring-*/Cargo.toml # we modified Cargo.toml so checksums are on longer valid on it sed -E -i 's/"Cargo.toml":"[a-z0-9]{64}",//g' vendor/ring-*/.cargo-checksum.json fi %build %cargo_build -f sqlite,mysql,postgresql %cargo_build -f sqlite %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies %{cargo_vendor_manifest} # some vendored files have executable bit but bad shebangs find vendor/ -type f -executable -exec chmod -x {} + %install %cargo_install -f sqlite,mysql,postgresql # filesystem install -d %{buildroot}%{_sharedstatedir}/%{name} install -d %{buildroot}%{_localstatedir}/run/%{name} # user install -Dpm 0644 %{SOURCE5} %{buildroot}%{_sysusersdir}/vaultwarden.conf # configs install -Dp %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name} install -Dp %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}/%{name}.cfg # systemd install -Dp %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service %if %{with check} %check %cargo_test -f sqlite,mysql,postgresql %endif %pre %sysusers_create_compat %{SOURCE5} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE.txt %license LICENSE.dependencies %license cargo-vendor.txt %doc README.md %doc SECURITY.md %{_bindir}/vaultwarden %{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %config(noreplace) %{_sysconfdir}/%{name}/%{name}.cfg %dir %{_sysconfdir}/%{name}/ %{_sysusersdir}/vaultwarden.conf %dir %attr(0755, vaultwarden, vaultwarden) %ghost %{_localstatedir}/run/%{name} %dir %attr(0750, vaultwarden, vaultwarden) %{_sharedstatedir}/%{name} %changelog * Tue May 21 2024 Jonathan Wright - 1.30.5-1 - Initial package build