File slimbookbattery.spec of Package slimbookbattery
#
# spec file for package slimbookbattery
#
# Copyright (c) 2023 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/
#
# exclude while 3.12 isn't default python in TW yet
%define skip_python312 1
Name: slimbookbattery
Version: 1675325758.980d5ce
Release: 0
Summary: Battery optimization application for portable devices
BuildArch: noarch
License: GPL-3.0
Group: System/Management
URL: https://github.com/Slimbook-Team/slimbookbattery
Source0: %{name}-%{version}.tar.xz
Patch0: %{name}-desktop.patch
BuildRequires: fdupes
BuildRequires: python3-base
BuildRequires: %{python_module gobject}
BuildRequires: python3-dbus-python-devel
BuildRequires: polkit
BuildRequires: desktop-file-utils
Requires: tlp
Requires: tlp-rdw
Requires: cron
# systray icon embedding
Recommends: typelib-1_0-AppIndicator3-0_1
Recommends: typelib-1_0-Notify-0_7
%description
Battery optimization application for portable devices that can increase
the battery life by 50%. For this purpose, the third-party software
(TLP and others) is used to manage and configure the system resources.
%prep
%autosetup -p1
%build
# nothing to do
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/polkit-1/actions/
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_udevrulesdir}
mkdir %{buildroot}%{_datadir}/pixmaps
mkdir %{buildroot}%{_datadir}/%{name}/custom
mkdir %{buildroot}%{_datadir}/%{name}/default
mkdir %{buildroot}%{_datadir}/%{name}/images
mkdir %{buildroot}%{_datadir}/%{name}/src
install -m 755 bin/* %{buildroot}/%{_bindir}
cp -r images/* %{buildroot}%{_datadir}/%{name}/images/
install images/%{name}.png %{buildroot}%{_datadir}/pixmaps/
chmod 644 src/service/*.service
chmod 644 src/configuration/*.desktop
chmod 755 src/*.py
chmod 755 src/translations/*.py
chmod 755 src/updates/*.sh
chmod 644 src/*utils.py
cp -r src/* %{buildroot}%{_datadir}/%{name}/src/
# avoid error about hardlink across partitiions (after fdupes run)
mv %{buildroot}%{_datadir}/%{name}/src/service/*.service %{buildroot}%{_unitdir}/
cp -r src/configuration/custom/* %{buildroot}%{_datadir}/%{name}/custom/
cp -r src/configuration/default/* %{buildroot}%{_datadir}/%{name}/default/
install -m 644 %{name}.desktop %{buildroot}%{_datadir}/applications/
install -m 644 policykit/* %{buildroot}%{_datadir}/polkit-1/actions/
install -m 644 udev-rules/* %{buildroot}%{_udevrulesdir}/
%fdupes %{buildroot}
pushd %{buildroot}%{_sbindir}
ln -s service rcslimbookbattery
popd
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%desktop_database_post
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%desktop_database_postun
%check
%files
%license LICENSE
%doc README.md
%{_bindir}/*
%{_sbindir}/*
%{_unitdir}/*
%{_udevrulesdir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/polkit-1/actions/*
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%changelog