diff --git a/Makefile b/Makefile index 8f4410e..fd4d113 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tuned.spec b/tuned.spec index 8889199..eb4a8bf 100644 --- a/tuned.spec +++ b/tuned.spec @@ -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 - 2.21.0-1 - new release diff --git a/tuned/ppd/dbus.conf b/tuned/ppd/dbus.conf new file mode 100644 index 0000000..2f2d6fa --- /dev/null +++ b/tuned/ppd/dbus.conf @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/tuned/ppd/ppd.conf b/tuned/ppd/ppd.conf new file mode 100644 index 0000000..9b2b9c6 --- /dev/null +++ b/tuned/ppd/ppd.conf @@ -0,0 +1,9 @@ +[main] +# The default PPD profile +default=balanced + +[profiles] +# PPD = TuneD +power-saver=powersave +balanced=balanced +performance=throughput-performance diff --git a/tuned/ppd/tuned-ppd.dbus.service b/tuned/ppd/tuned-ppd.dbus.service new file mode 100644 index 0000000..7866f09 --- /dev/null +++ b/tuned/ppd/tuned-ppd.dbus.service @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=net.hadess.PowerProfiles +Exec=/bin/false +User=root +SystemdService=tuned-ppd.service diff --git a/tuned/ppd/tuned-ppd.policy b/tuned/ppd/tuned-ppd.policy new file mode 100644 index 0000000..8106808 --- /dev/null +++ b/tuned/ppd/tuned-ppd.policy @@ -0,0 +1,29 @@ + + + + + TuneD + https://tuned-project.org/ + + + Hold power profile + Authentication is required to hold power profiles. + + no + no + yes + + + + + Release power profile + Authentication is required to release power profiles. + + no + no + yes + + + + diff --git a/tuned/ppd/tuned-ppd.service b/tuned/ppd/tuned-ppd.service new file mode 100644 index 0000000..e571776 --- /dev/null +++ b/tuned/ppd/tuned-ppd.service @@ -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