File amdgpu-fan.spec of Package amdgpu-fan

#
# spec file for package amdgpu-fan
#
# Copyright (c) 2022 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:           amdgpu-fan
Version:        0.0.6
Release:        0
Summary:        Fan controller for amdgpus
License:        GPL-2.0-only
Group:          System/Daemons
URL:            https://github.com/chestm007/amdgpu-fan
Source0:        https://github.com/chestm007/amdgpu-fan/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM amdgpu-fan_fix_WantedBy.patch
Patch0:         amdgpu-fan_fix_WantedBy.patch
# PATCH-FIX-UPSTREAM amdgpu-fan-fix_yaml.patch
Patch1:         amdgpu-fan-fix_yaml.patch
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(libsystemd)
Requires:       python3-PyYAML
Requires:       python3-numpy
BuildArch:      noarch

%description
Python daemon for controlling the fans on amdgpu cards

%prep
%autosetup -p1
sed -i "s/PROJECTVERSION/%{version}/g" setup.py

%build
python3 setup.py build

%install
python3 setup.py install --root=%{buildroot} --prefix=%{_prefix}
mkdir -pv %{buildroot}%{_unitdir} %{buildroot}%{_sbindir}
install -Dm644 amdgpu-fan.service %{buildroot}%{_unitdir}
pushd %{buildroot}%{_sbindir}
ln -s service rc%{name}
popd

%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 LICENSE
%doc README.md
%{_bindir}/%{name}
%{_sbindir}/rc%{name}
%{_unitdir}/%{name}.service
%{python3_sitelib}/*


%changelog
openSUSE Build Service is sponsored by