1
0
Fork 0

Configure the PPD-to-TuneD daemon to work as a replacement of PPD

This includes the configuration of DBus, systemd, Polkit, and a new
TuneD Fedora/RHEL subpackage.
This commit is contained in:
Pavol Žáčik 2024-02-06 17:05:14 +01:00
parent d4b72b2709
commit 3e03b8b6ca
No known key found for this signature in database
GPG key ID: B99527D5E6487A92
7 changed files with 101 additions and 0 deletions

View file

@ -223,6 +223,14 @@ install: install-dirs
install -dD $(DESTDIR)$(DATADIR)/applications
desktop-file-install --dir=$(DESTDIR)$(DATADIR)/applications tuned-gui.desktop
install-ppd: install
$(call install_python_script,tuned-ppd.py,$(DESTDIR)/usr/sbin/tuned-ppd)
install -Dpm 0644 tuned/ppd/tuned-ppd.service $(DESTDIR)$(UNITDIR)/tuned-ppd.service
install -Dpm 0644 tuned/ppd/tuned-ppd.dbus.service $(DESTDIR)$(DATADIR)/dbus-1/system-services/net.hadess.PowerProfiles.service
install -Dpm 0644 tuned/ppd/dbus.conf $(DESTDIR)$(DATADIR)/dbus-1/system.d/net.hadess.PowerProfiles.conf
install -Dpm 0644 tuned/ppd/tuned-ppd.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/net.hadess.PowerProfiles.policy
install -Dpm 0644 tuned/ppd/ppd.conf $(DESTDIR)$(SYSCONFDIR)/tuned/ppd.conf
clean: clean-html
find -name "*.pyc" | xargs rm -f
rm -rf $(VERSIONED_NAME) rpm-build-dir

View file

@ -264,6 +264,17 @@ Requires: %{name} = %{version}
%description profiles-openshift
Additional TuneD profile(s) optimized for OpenShift.
%package ppd
Summary: PPD compatibility daemon
Requires: %{name} = %{version}
# The compatibility daemon is swappable for power-profiles-daemon
Provides: ppd-service
Conflicts: ppd-service
%description ppd
An API translation daemon that allows applications to easily transition
to TuneD from power-profiles-daemon (PPD).
%prep
%autosetup -p1 -n %{name}-%{version}%{?prerel2}
@ -276,6 +287,7 @@ make html %{make_python_arg}
%install
make install DESTDIR=%{buildroot} DOCDIR=%{docdir} %{make_python_arg}
make install-ppd DESTDIR=%{buildroot} DOCDIR=%{docdir} %{make_python_arg}
%if 0%{?rhel}
sed -i 's/\(dynamic_tuning[ \t]*=[ \t]*\).*/\10/' %{buildroot}%{_sysconfdir}/tuned/tuned-main.conf
%endif
@ -556,6 +568,14 @@ fi
%{_prefix}/lib/tuned/openshift-node
%{_mandir}/man7/tuned-profiles-openshift.7*
%files ppd
%{_sbindir}/tuned-ppd
%{_unitdir}/tuned-ppd.service
%{_datadir}/dbus-1/system-services/net.hadess.PowerProfiles.service
%{_datadir}/dbus-1/system.d/net.hadess.PowerProfiles.conf
%{_datadir}/polkit-1/actions/net.hadess.PowerProfiles.policy
%config(noreplace) %{_sysconfdir}/tuned/ppd.conf
%changelog
* Tue Aug 29 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2.21.0-1
- new release

16
tuned/ppd/dbus.conf Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="net.hadess.PowerProfiles"/>
</policy>
<policy context="default">
<allow send_destination="net.hadess.PowerProfiles" send_interface="net.hadess.PowerProfiles"/>
<allow send_destination="net.hadess.PowerProfiles" send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="net.hadess.PowerProfiles" send_interface="org.freedesktop.DBus.Properties"/>
<allow send_destination="net.hadess.PowerProfiles" send_interface="org.freedesktop.DBus.Peer"/>
</policy>
</busconfig>

9
tuned/ppd/ppd.conf Normal file
View file

@ -0,0 +1,9 @@
[main]
# The default PPD profile
default=balanced
[profiles]
# PPD = TuneD
power-saver=powersave
balanced=balanced
performance=throughput-performance

View file

@ -0,0 +1,5 @@
[D-BUS Service]
Name=net.hadess.PowerProfiles
Exec=/bin/false
User=root
SystemdService=tuned-ppd.service

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>TuneD</vendor>
<vendor_url>https://tuned-project.org/</vendor_url>
<action id="net.hadess.PowerProfiles.HoldProfile">
<description>Hold power profile</description>
<message>Authentication is required to hold power profiles.</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="net.hadess.PowerProfiles.ReleaseProfile">
<description>Release power profile</description>
<message>Authentication is required to release power profiles.</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
</policyconfig>

View file

@ -0,0 +1,14 @@
[Unit]
Description=PPD-to-TuneD API Translation Daemon
Requires=tuned.service
After=tuned.service
Before=multi-user.target display-manager.target
[Service]
Type=dbus
PIDFile=/run/tuned/tuned-ppd.pid
BusName=net.hadess.PowerProfiles
ExecStart=/usr/sbin/tuned-ppd
[Install]
WantedBy=graphical.target