File mcp-server-systemd.spec of Package mcp-server-systemd
#
# spec file for package mcp-server-systemd
#
# Copyright (c) 2025 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/
#
%define gitname systemd-mcp
%define vers 0.2.0
#%%define verssuf -preview3
#%%define verssuf_plain %(echo %{verssuf} | sed 's/^-//')
Name: mcp-server-systemd
Version: %{vers}%{?verssuf_plain}
Release: 0
Summary: Bindings to systemd via mcp
License: MIT
URL: https://github.com/openSUSE/systemd-mcp
Source0: https://github.com/openSUSE/systemd-mcp/archive/refs/tags/v%{vers}%{?verssuf}.tar.gz#/%{name}-%{vers}%{?verssuf}.tar.gz
Source1: vendor.tar.gz
BuildRequires: dbus-1
BuildRequires: go >= 1.24
BuildRequires: libcap-progs
BuildRequires: polkit
BuildRequires: systemd-devel
Requires: libcap-progs
%description
mcp server which allows to
* list units/services
* start/stop/restart units/services
* enable/disable services
* list log
%prep
%autosetup -p1 -a1 -n %{gitname}-%{vers}%{?verssuf}
%build
# The macro make_build does not work on older CentOS versions
make
%install
# The macro make_install does not work on older CentOS versions
make install DESTDIR=%{buildroot}
# RPM automatically stores hardlinked files only once
ln %{buildroot}/%{_bindir}/%{gitname} %{buildroot}/%{_bindir}/%{name}
%post
setcap cap_dac_read_search=+ep %{_bindir}/%{gitname}
%check
# just run the test which dpon't need podman
go test \
github.com/openSUSE/systemd-mcp/internal/pkg/man \
github.com/openSUSE/systemd-mcp/internal/pkg/util \
github.com/openSUSE/systemd-mcp/remoteauth \
%{nil}
%files
%caps(cap_dac_read_search=+ep) %{_bindir}/%{gitname}
%{_bindir}/%{name}
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/system.d
%{_datadir}/dbus-1/system.d/org.opensuse.systemdmcp.conf
%{_datadir}/polkit-1/actions/org.opensuse.systemdmcp.policy
%license LICENSE
%doc README.md
%changelog