File Alfis.spec of Package Alfis

#
# spec file for package Alfis
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

Name:           Alfis
Version:        0.8.8
Release:        0
Summary:        Alternative Free Identity System
License:        GPL-3.0-only
URL:            https://github.com/Revertron/Alfis
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
BuildRequires:  cargo-packaging
BuildRequires:  coreutils
BuildRequires:  glib2-devel
BuildRequires:  libsoup2-devel
BuildRequires:  systemd-rpm-macros
BuildRequires:  sysuser-tools
BuildRequires:  wayland-devel
BuildRequires:  webkit2gtk3-devel
BuildRequires:  webkit2gtk4-devel
Requires:       coreutils
Provides:       user(alfis)
%sysusers_requires

%description
Alfis - Alternative Free Identity System

%prep
%setup -q
%setup -q -T -D -a 1

%build
%{cargo_build}

%check
%cargo_test -- -- --skip test_tcp_client --skip test_udp_client

%sysusers_generate_pre %{_sysusersdir}/system-user-alfis.conf alfis

%install
install -Dm 755  target/release/alfis %{buildroot}%{_bindir}/alfis
install -Dm 644  contrib/systemd/alfis-default-config.service %{buildroot}%{_unitdir}/alfis-default-config.service
install -Dm 644  contrib/systemd/alfis.service %{buildroot}%{_unitdir}/alfis.service
install -Dm 644  contrib/systemd/alfis.tmpfiles %{buildroot}%{_tmpfilesdir}/alfis.conf
install -Dm 644  contrib/systemd/alfis.sysusers %{buildroot}%{_sysusersdir}/system-user-alfis.conf
install -Dm 644  contrib/name.alfis.Alfis.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644  img/logo/alfis_logo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/alfis.svg

%files
%license LICENSE
%doc README.md docs/about_ru.md docs/faq_ru.md
%{_bindir}/alfis
%{_unitdir}/alfis-default-config.service
%{_unitdir}/alfis.service
%{_tmpfilesdir}/alfis.conf
%{_sysusersdir}/system-user-alfis.conf
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/alfis.svg
%ghost %attr(700,alfis,alfis) /var/lib/alfis

%pre -f alfis.pre
%service_add_pre alfis.service alfis-default-config.service

%post
%service_add_post alfis.service alfis-default-config.service
%sysusers_create %{_sysusersdir}/system-user-alfis.conf
%tmpfiles_create %{_tmpfilesdir}/alfis.conf

%preun
%service_del_preun alfis.service alfis-default-config.service

%postun
%service_del_postun alfis.service alfis-default-config.service

%changelog
openSUSE Build Service is sponsored by