File rustfs.spec of Package rustfs

#
# spec file for package rustfs
#
# 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:           rustfs
Version:        1.0.0~alpha.45
Release:        0
Summary:        High-performance distributed object storage software built using Rust
License:        Apache-2.0
URL:            https://github.com/rustfs/rustfs
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        %{name}.service
Source21:       system-user-%{name}.conf
BuildRequires:  cargo-packaging
BuildRequires:  glib2-devel
BuildRequires:  gtk3-devel
BuildRequires:  libsoup-devel
# BuildRequires:  libjavascriptcoregtk-4_0-18
BuildRequires:  libjavascriptcoregtk-4_1-0

%description
RustFS is a high-performance distributed object storage software built using
Rust, one of the most popular languages worldwide. Along with MinIO, it shares
a range of advantages such as simplicity, S3 compatibility, open-source nature,
support for data lakes, AI, and big data. Furthermore, it has a better and more
user-friendly open-source license in comparison to other storage systems, being
constructed under the Apache license. As Rust serves as its foundation, RustFS
provides faster speed and safer distributed features for high-performance
object storage.

%prep
%autosetup -p 1 -a 1

%build
%{cargo_build}

# system-user
%sysusers_generate_pre %{SOURCE21} user

%install
install -D -d -m 0755 %{buildroot}%{_bindir}
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name}

# server systemd unit file
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service

# configuration in /etc/rustfs/
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/

# directory in /var/lib/
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}

# system user
install -Dm644 %{SOURCE21} %{buildroot}%{_sysusersdir}/system-user-%{name}.conf

%pre -f user.pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%doc README.md
%license LICENSE
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%{_sysusersdir}/system-user-%{name}.conf

%dir %attr(755,root, %{name}) %{_sysconfdir}/%{name}/
%ghost %config(noreplace) %{_sysconfdir}/%{name}/%{name}.toml
%dir %attr(750,%{name}, %{name}) %{_sharedstatedir}/%{name}/
%dir %attr(750,%{name}, %{name}) %{_sharedstatedir}/%{name}/data/
%dir %attr(750,%{name}, %{name}) %{_sharedstatedir}/%{name}/meta/

%changelog
openSUSE Build Service is sponsored by