Skip to content

Commit

Permalink
Add Meson installer
Browse files Browse the repository at this point in the history
  • Loading branch information
gasinvein committed Sep 7, 2019
1 parent eab330f commit 3f75102
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,22 @@
A small daemon which pretends to be the GameMode dbus service, but instead switches Tuned profiles.

E.g. when a RegisterGame() call is received from a GameMode client, it switches profile to "performance", and switches it back when no more games are registered.

## Requirements

* [Tuned](https://github.com/redhat-performance/tuned), obviously
* Python 3, with modules
* PyGObject
* pydbus
* psutil
* pyxdg

## Installation

This shim uses the same bus name as GameMode, and thus conflicts with it.
Make sure that GameMode is not installed.

```bash
meson --prefix ~/.local . build
ninja -C build install
```
3 changes: 3 additions & 0 deletions data/com.feralinteractive.GameMode.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[D-BUS Service]
Name=com.feralinteractive.GameMode
Exec=@bindir@/tunedmode
32 changes: 32 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project('tunedmode')

pymod = import('python')
python = pymod.find_installation('python3', modules: [
'PyGObject',
'pydbus',
'psutil',
'pyxdg'
])

bindir = join_paths(get_option('prefix'), get_option('bindir'))
datadir = join_paths(get_option('prefix'), get_option('datadir'))

conf = configuration_data()
conf.set('bindir', bindir)

python.install_sources('tunedmode.py', pure: true)

configure_file(
input: 'scripts/tunedmode.in',
output: 'tunedmode',
configuration: conf,
install_dir: bindir,
install_mode: 'rwxr-xr-x'
)

configure_file(
input: 'data/com.feralinteractive.GameMode.service.in',
output: 'com.feralinteractive.GameMode.service',
configuration: conf,
install_dir: join_paths(datadir, 'dbus-1', 'services')
)
6 changes: 6 additions & 0 deletions scripts/tunedmode.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3

import tunedmode

if __name__ == "__main__":
tunedmode.main()
3 changes: 0 additions & 3 deletions tunedmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,3 @@ def main():
"""Start TunedMode from command line."""
config_path = os.path.join(save_config_path('tunedmode'), 'tunedmode.ini')
run_tunedmode(init_config(config_path))

if __name__ == '__main__':
main()

0 comments on commit 3f75102

Please sign in to comment.