On Sun, 22 Sep 2024 16:37:37 +0200 Francesco Poli wrote:

[...]
> I reiterate the request to integrate the three files into the
> 'linux-cpupower' package, with the systemd service disabled by default.
[...]

I have further improved the 'cpupower.sh' after analyzing it with
shellcheck (Debian package 'shellcheck').

I am re-attaching the three files to this message, for clarity's sake.

> I acknowledge that they are probably sub-optimal and could be further
> generalized and/or enhanced.
> But, until someone comes up with a better solution, they are better
> than nothing...
> The current situation is that every user has to set up ad-hoc solutions
> (perhaps involving the deprecated 'rc.local' file or otherwise), unless
> he/she can leverage some desktop tool...
> 
> And, of course, any of you from the Debian Kernel Team can further
> improve the files at any time.
> But, please, first ship the three files in the package, without waiting
> for the perfect solution. This bug report has been open since April
> 2018... As Voltaire once said, the better is the enemy of the good.

Please, pretty please, ship the three files with the 'linux-cpupower'
package, setting the systemd service disabled by default.

Let's fix this bug once and for all!





N.B.:
For any user who wants to manually install the three attached files
*before* they are shipped by 'linux-cpupower', the commands are:

  # install -m 644 cpupower.default /etc/default/cpupower
  # install -m 755 cpupower.sh /usr/libexec/cpupower
  # install -m 644 cpupower.service /usr/lib/systemd/system/
  # systemctl daemon-reload

After this manual installation (or once the 'linux-cpupower' package
ships them and installs the systemd service disabled by default), the
administrator (root user) can edit /etc/default/cpupower as appropriate
and then issue the command:

  # systemctl enable --now cpupower.service



-- 
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

Attachment: cpupower.default
Description: Binary data

Attachment: cpupower.service
Description: Binary data

#!/bin/sh
# Copyright (C) 2012, Sébastien Luttringer
# Copyright (C) 2024, Francesco Poli <invernom...@paranoici.org>
# SPDX-License-Identifier: GPL-2.0-or-later

ESTATUS=0

# apply CPU clock frequency options
if test -n "$FREQ"
then
    cpupower frequency-set -f "$FREQ" > /dev/null || ESTATUS=1
elif test -n "${GOVERNOR}${MIN_FREQ}${MAX_FREQ}"
then
    cpupower frequency-set \
      ${GOVERNOR:+ -g "$GOVERNOR"} \
      ${MIN_FREQ:+ -d "$MIN_FREQ"} ${MAX_FREQ:+ -u "$MAX_FREQ"} \
      > /dev/null || ESTATUS=1
fi

# apply CPU policy options
if test -n "$PERF_BIAS"
then
    cpupower set -b "$PERF_BIAS" > /dev/null || ESTATUS=1
fi

exit $ESTATUS

Attachment: pgpYafSnHlDxP.pgp
Description: PGP signature

Reply via email to