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 7 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
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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)"

reload:
@echo Reloading extension '[email protected]'...
@gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Extensions.ReloadExtension [email protected]
119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,85 @@ 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

Impersonate the (non-admin) user, clone the git repository, and run the following command:

> Note: Cloning and installing the extension while impersonating the other user, enables this user
> to install updates for this extension from extensions.gnome.org.

```shell
$ sudo -u username bash
$ cd /tmp
$ git clone https://github.com/martin31821/cpupower.git
$ cd cpupower
$ 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

Impersonate the (non-admin) user, clone the git repository, and run the following command:

> Note: Cloning and installing the extension while impersonating the other user, enables this user
> to install updates for this extension from extensions.gnome.org. However, the tool **must**
> be updated and installed by an administrator. The extension may stop working after the user
> installed an update and may need updating of the tool by an administrator.

```shell
$ sudo -u username bash
$ cd /tmp
$ git clone https://github.com/martin31821/cpupower.git
$ cd cpupower
$ make install PREFIX=/home/username/.local
```

And with an admin user run the following commands:

```shell
$ sudo make install-tool TOOL_SUFFIX=username
```

> Note: Also, use this command to update the tool for another user in an outdated installation.

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
$ sudo 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 +99,43 @@ 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

### Option 1

Clone the repository and run:

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

and reload the extension with:

```shell
$ make reload
```

### Option 2

Clone the respository to `~/.local/share/gnome-shell/extensions/[email protected]` and reload the extension with:

```shell
$ make reload
```

You can now enable the extension in your extension settings.

### Viewing log output

```shell
$ journalctl -t gnome-shell -f
fin-ger marked this conversation as resolved.
Show resolved Hide resolved
```

### Creating a new release

Only core contributors to this project can make a new release. To create one, run:

```shell
$ make release
```
Loading