File iocaine.spec of Package iocaine

#
# spec file for package iocaine
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# 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:           iocaine
Version:        3.3.0
Release:        0
Summary:        The deadliest poison known to AI
License:        MIT
URL:            https://iocaine.madhouse-project.org/
Source0:        https://git.madhouse-project.org/%{name}/%{name}/archive/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        get_assets.sh
Source3:        assets-%{version}.tar.zst
Source4:        iocaine.sysusers
Source5:        iocaine.logrotate
Patch0:         service.patch
BuildRequires:  rust >= 1.85
BuildRequires:  cargo-packaging
BuildRequires:  clang
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libnftables)
BuildRequires:  pkgconfig(systemd)
%{?systemd_ordering}
%sysusers_requires
Recommends:     logrotate

%description
An AI-poisoning tarpit written in rust.

%prep
%autosetup -p1 -n %{name}
tar --zstd -xf %{SOURCE1}
tar --zstd -xf %{SOURCE3}

%build
export NFTABLES_INCLUDE_DIR=%{_includedir}/nftables/
%cargo_build

%sysusers_generate_pre %{SOURCE4} %{name}

%install
install -D -m 0755  target/release/iocaine %{buildroot}%{_sbindir}/iocaine
install -D -m 0750 -d %{buildroot}/var/lib/%{name}/ \
                      %{buildroot}/var/log/%{name}/ \
                      %{buildroot}/etc/%{name}/
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -D -m 0644 iocaine-powder/embeds/%{name}.service  %{buildroot}%{_unitdir}/%{name}.service

%pre -f %{name}.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
%license LICENSES/MIT.txt
%doc CHANGELOG.md README.md
%{_sbindir}/iocaine
%{_unitdir}/%{name}.service
%{_sysusersdir}/%{name}.conf
%config(noreplace)  %attr(-,root,%{name}) /etc/%{name}/
%config(noreplace)  %{_sysconfdir}/logrotate.d/%{name}
%dir  %attr(-,%{name},%{name})  /var/lib/%{name}/
%dir  /var/log/%{name}/

%changelog
openSUSE Build Service is sponsored by