Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile and new installation methods supporting multi-user environments #107

Merged
merged 34 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e89b711
Add Makefile and adjust installation according to #102, #84, #95
Mar 30, 2020
f0cd15b
Implement new install mechanism
Mar 30, 2020
10383d7
Add uninstall button, fixes #58
Mar 30, 2020
988b5ad
Add notes to readme for new installation methods
Mar 30, 2020
1098e4d
Add development instructions to readme
Mar 30, 2020
288a370
Update instructions in readme and adjust release script
Mar 31, 2020
e7468f7
Reload extension after uninstalling, close preferences after uninstal…
Mar 31, 2020
ee7a6db
Untabified
Mar 31, 2020
30750fb
Update translation template and add instructions to readme
Mar 31, 2020
695478e
Add github release workflow
Mar 31, 2020
3ed3535
Update readme layout
Mar 31, 2020
8ed6c91
Add gnome extension zip to github release action
Mar 31, 2020
390ee19
Fix badge url in readme
Mar 31, 2020
b762da3
Fix wrong version path in github action
Mar 31, 2020
b817e12
Make release action create actual releases
Mar 31, 2020
b8aeed9
Make paths in installation tab of preferences selectable
Mar 31, 2020
dcebeed
Fix typo in readme
Mar 31, 2020
63ef742
Add .mo compilation to makefile and add update of polkit rule
Apr 1, 2020
326bd57
Add packaging notes to readme
Apr 1, 2020
4d40a86
Fix reloading of extension after tool uninstall and remove reload tar…
Apr 1, 2020
ed7b6a5
Add gnome-shell restart notes to readme
Apr 1, 2020
863f96f
Add polkit rule as suggested by @mastercaution
Apr 1, 2020
98ec022
Add debug build action
Apr 1, 2020
4c11389
Fix silent unknown action
Apr 1, 2020
be89b51
Add gnome 3.28 legacy support for Ubuntu 18.04 and fix supported chec…
Apr 2, 2020
5b75dc6
Replace gnome-extension tool for reloading extension with gnome-shell…
Apr 2, 2020
6014a7b
Fix heading weight
Apr 2, 2020
bdab761
Fix wrong description in readme
Apr 2, 2020
0e41c73
Fix translation not working in update menu
Apr 5, 2020
5fd58c9
Make msgfmt, pkg-config, and glib-compiles-schema binaries configurable
Apr 5, 2020
4dd7a19
Change journalctl command in README
Apr 5, 2020
6167bea
Fix #112
Apr 5, 2020
070f792
As preferences window is displayed with the new gnome-extensions tool…
Apr 5, 2020
1c43ca5
Remove pkg-config dependency
Apr 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.last-settings
mko.cpupower.policy
*.mo
target
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PREFIX ?= /usr

VERSION="8.0.0"
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
fin-ger marked this conversation as resolved.
Show resolved Hide resolved
EXTENSION_INSTALL_DIR = "$(PREFIX)/share/gnome-shell/extensions/[email protected]"
EXTENSION_FILES="$(shell find . -path './.git' -prune -o -path './target' -prune -o -print)"

build:
@echo Compiling schemas...
@glib-compile-schemas ./schemas

clean:
@rm -r target

package: build
@mkdir -p target
@zip target/cpupower-${VERSION}.zip "$(EXTENSION_FILES)"

install: package
@mkdir -p "$(EXTENSION_INSTALL_DIR)"
@unzip -o target/cpupower-${VERSION}.zip -d "$(EXTENSION_INSTALL_DIR)"

uninstall:
@rm -r "$(EXTENSION_INSTALL_DIR)"

install-tool:
@./tool/installer.sh --prefix "$(PREFIX)" --tool-suffix "$(TOOL_SUFFIX)" install

uninstall-tool:
@./tool/installer.sh --prefix "$(PREFIX)" --tool-suffix "$(TOOL_SUFFIX)" uninstall

release:
@./scripts/release.sh "$(VERSION)"
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,62 @@ Click on the CPU icon in the top bar of your Gnome shell and follow the installa
You need to enter your root password to install a policy kit rule. This rule is used to set the clock
frequency of your CPU with your user.

### Installing for another (admin) user

Clone the git repository and run the following command:

```shell
$ make install PREFIX=/home/username/.local
```

The user can enable the extension in his settings and install the polkit rule and `cpufreqctl` tool by using the included installation guide.

#### Uninstalling

The user can uninstall the tools in the settings of this extension. The extension itself can be removed from withing the extension settings or with this command:

```shell
$ make uninstall PREFIX=/home/username/.local
```

### Installing for another (non-admin) user

Clone the git repository and run the following command:

```shell
$ make install PREFIX=/home/username/.local
$ sudo make install-tool TOOL_SUFFIX=username
```

The extension will work out-of-the-box for the specified user only!

> Note: Using another PREFIX than `/usr` in this setup might include security risks and may not work.

#### Uninstalling

```shell
$ make uninstall PREFIX=/home/username/.local
$ sudo make uninstall-tool TOOL_SUFFIX=username
```

### Installing for all users

Clone the git repository and run the following command:

```shell
$ sudo make install install-tool
```

This will install the extensions, polkit rule, and the tool for all users on the system.

#### Uninstalling

Run the following command to uninstall:

```shell
$ sudo make uninstall uninstall-tool
```

## Prerequisites

You need to have an **Intel Core i CPU** of at least the **second Generation (2xxx Model Number)** and the following
Expand All @@ -20,3 +76,13 @@ software installed to use this extension:
- Policykit (ships default with gnome)
- intel_pstate needs to be enabled in the kernel (should be the default in almost all Distros)
- bash

## Developing

Clone the repository and run:

```shell
$ make install PREFIX=/home/username/.local
```

and restart the gnome shell (`Alt+F2` `r`).
204 changes: 196 additions & 8 deletions data/cpupower-preferences.glade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0
<!-- Generated with glade 3.22.2

Copyright (C) 2015-2017
Copyright (C) 2015-2020

This file is part of CPU Power Gnome-Shell extension.

Expand All @@ -27,7 +27,7 @@ Fin Christensen
CPUPower for GNOME Shell preferences
- Creates a widget to set the preferences of the cpupower extension

Copyright (C) 2012
Copyright (C) 2012-2020
Martin Koppehel <[email protected]>,

This file is part of the gnome-shell extension cpupower.
Expand All @@ -51,13 +51,13 @@ along with gnome-shell extension cpupower. If not, see
<!-- interface-license-type gplv3 -->
<!-- interface-name CPU Power Gnome-Shell extension -->
<!-- interface-description Creates a widget to set the preferences of the cpupower extension -->
<!-- interface-copyright 2015-2017 -->
<!-- interface-copyright 2015-2020 -->
<!-- interface-authors Martin Koppehel\nFin Christensen -->
<object class="GtkAboutDialog" id="AboutDialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<property name="program_name">CPU Power Manager</property>
<property name="version">git@dev</property>
<property name="version">8.0.0</property>
<property name="comments" translatable="yes">Gnome-Shell Extension for the intel-pstate driver.</property>
<property name="website">https://github.com/martin31821/cpupower</property>
<property name="authors">Martin Koppehel (@martin31821)
Expand All @@ -72,6 +72,9 @@ Jimmy Scionti (@amivaleo)</property>
<property name="artists">Thanasis Georgiou (@sakisds)</property>
<property name="logo">icons/cpu-symbolic.svg</property>
<property name="license_type">gpl-3-0</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
Expand Down Expand Up @@ -99,9 +102,6 @@ Jimmy Scionti (@amivaleo)</property>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
<object class="GtkNotebook" id="MainWidget">
<property name="visible">True</property>
Expand Down Expand Up @@ -503,6 +503,139 @@ Jimmy Scionti (@amivaleo)</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="InstallationGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">8</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<child>
<object class="GtkLabel" id="CpufreqctlLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Path to cpufreqctl:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="PolicykitRuleLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Path to policykit rule:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="InstallationWarningLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">20</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">CPU Power Manager is installed via your distributions package manager!</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="UninstallButton">
<property name="label" translatable="yes">Uninstall</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<signal name="clicked" handler="onUninstallButtonClicked" swapped="no"/>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="CpufreqctlPathLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">/usr/bin/cpufreqctl</property>
<property name="ellipsize">middle</property>
<property name="xalign">0</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="PolicykitRulePathLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">/usr/share/polkit-1/actions/mko.cpupower.setcpufreq.policy</property>
<property name="ellipsize">middle</property>
<property name="xalign">0</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="Spacer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="InstallationTabLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Installation</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<object class="GtkAdjustment" id="MaximumFrequencyAdjustment">
<property name="upper">100</property>
Expand Down Expand Up @@ -808,4 +941,59 @@ Jimmy Scionti (@amivaleo)</property>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="UninstallMessageDialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<property name="message_type">question</property>
<property name="text" translatable="yes">Uninstall CPU Power Manager Tools</property>
<property name="secondary_text" translatable="yes">Are you sure you want to uninstall the cpufreqctl tool and the polkit rule?</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="UninstallDialogCancel">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="UninstallDialogUninstall">
<property name="label" translatable="yes">Uninstall</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
5 changes: 3 additions & 2 deletions data/mko.cpupower.policy.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<vendor>MKO Systems</vendor>
<vendor_url>http://mko-sl.de</vendor_url>

<action id="mko.cpupower.setcpufreq">
<action id="{{ID}}">
<description>Set a new CPU Frequency to intel_pstate</description>
<description xml:lang="de">Neue CPU-Frequenzgrenzen an intel_pstate senden</description>
<message>No Authorization required to set frequency bounds.</message>
Expand All @@ -16,7 +16,8 @@
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">xxxPATHxxx</annotate>
<annotate key="org.freedesktop.policykit.exec.path">{{PATH}}</annotate>
<annotate key="mko.cpupower.version">{{VERSION}}</annotate>
</action>

</policyconfig>
Loading