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.13
Release: 0
Summary: MTProxy for Telegram on Rust + Tokio
License: TELEMT-UL1
URL: https://github.com/telemt/telemt
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
BuildRequires: cargo-packaging
BuildRequires: systemd-rpm-macros
BuildRequires: sed
Requires: coreutils
%description
MTProxy for Telegram on Rust + Tokio
%prep
%setup -q
%setup -q -T -D -a 1
%build
%{cargo_build}
%install
sed -i 's|ExecStart=/bin/telemt|ExecStart=/usr/bin/telemt|g' %{name}.service
sed -i 's|WorkingDirectory=/etc/telemt|WorkingDirectory=/tmp|g' %{name}.service
install -Dm 755 target/release/%{name} %{buildroot}%{_bindir}/%{name}
install -Dm 644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -Dm 644 config.toml %{buildroot}%{_sysconfdir}/%{name}.toml
install -Dm 644 config.full.toml %{buildroot}%{_sysconfdir}/%{name}.full.toml
#%%check
#%%cargo_test
%files
%doc README.md
%license LICENSING.md
%{_bindir}/telemt
%{_unitdir}/%{name}.service
%config (noreplace) %{_sysconfdir}/%{name}.toml
%config (noreplace) %{_sysconfdir}/%{name}.full.toml
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%changelog