File telemt.spec of Package telemt
#
# spec file for package telemt
#
# 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: telemt
Version: 3.3.32
Release: 0
Summary: MTProxy for Telegram on Rust + Tokio
License: TELEMTPL3
URL: https://github.com/telemt/telemt
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
BuildRequires: cargo-packaging
BuildRequires: systemd-rpm-macros
BuildRequires: sed
BuildRequires: sysuser-tools
Requires: coreutils
Provides: user(telemt)
%sysusers_requires
%description
MTProxy for Telegram on Rust + Tokio
%prep
%setup -q
%setup -q -T -D -a 1
%build
%{cargo_build}
%install
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
install -Dm 755 target/release/%{name} %{buildroot}%{_bindir}/%{name}
install -Dm 644 contrib/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -Dm 644 contrib/systemd/system-user-%{name}.conf %{buildroot}%{_sysusersdir}/system-user-%{name}.conf
install -Dm 644 contrib/systemd/tmpfiles-%{name}.conf %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -Dm 644 config.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.toml
#install -Dm 644 config.full.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.full.toml
#%%check
#%%cargo_test
%files
%doc README.md docs
%license LICENSE
%{_bindir}/telemt
%{_unitdir}/%{name}.service
%dir %{_sysconfdir}/%{name}
%config (noreplace) %{_sysconfdir}/%{name}/%{name}.toml
#%%config (noreplace) %{_sysconfdir}/%{name}/%{name}.full.toml
%{_sysusersdir}/system-user-%{name}.conf
%{_tmpfilesdir}/%{name}.conf
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%sysusers_create %{_sysusersdir}/system-user-%{name}.conf
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%changelog