aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Čerman2019-12-29 17:34:07 +0100
committerOndrej Čerman2019-12-29 17:34:07 +0100
commit600680d3ec25de8e6a7816447577ff3c2a5e185d (patch)
tree8447eef4a093448effdac6b533e6000134ab3f7f
parent495045ef2ac3c14e2eb2cf49b5c43a11ad5d247b (diff)
Makefile: Added option for app installation
-rw-r--r--README.md27
-rw-r--r--data/org.pkexec.zenmonitor.policy.in18
-rw-r--r--data/zenmonitor-root.desktop.in8
-rw-r--r--data/zenmonitor.desktop.in8
-rwxr-xr-xmakefile28
5 files changed, 84 insertions, 5 deletions
diff --git a/README.md b/README.md
index d4bdd34..c823858 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,14 @@ It can monitor these values:
- CPU Temperature
- CPU Core (SVI2) Voltage, Current and Power
- SOC (SVI2) Voltage, Current and Power
- - Package and Core Power
+ - Package and Core Power (RAPL)
- Core Frequency (from OS)
![screenshot](screenshot.png)
## Dependencies
- [zenpower driver](https://github.com/ocerman/zenpower/) - For monitoring CPU temperature and SVI2 sensors
- - MSR driver - For monitoring Package/Core Power
+ - MSR driver - For monitoring Package/Core Power (RAPL)
Follow [zenpower README.md](https://github.com/ocerman/zenpower/blob/master/README.md) to install and activate zenpower module.
Enter `sudo modprobe msr` to enable MSR driver.
@@ -23,9 +23,25 @@ Make sure that GTK3 dev package and common build tools are installed.
make
```
-## Running
+## Launching
+You can launch app by `sudo ./zenmonitor`, or you can install it to your system and then launch it from your OS menu.
+
+Note: Because superuser privileges are usually needed to access data from MSR driver, you need to launch zenmonitor as root for monitoring CPU power usage (RAPL).
+
+## Installing
+By default, Zenmonitor will be installed to /usr/local.
+```
+sudo make install
+```
+
+To add menu item for launching zenpower as root (Polkit is required):
+```
+sudo make install-polkit
+```
+
+## Uninstalling
```
-sudo ./zenpower
+sudo make uninstall
```
## Setup on ubuntu
@@ -39,5 +55,6 @@ cd ~
git clone https://github.com/ocerman/zenmonitor
cd zenmonitor
make
-sudo ./zenmonitor
+sudo make install
+sudo make install-polkit
```
diff --git a/data/org.pkexec.zenmonitor.policy.in b/data/org.pkexec.zenmonitor.policy.in
new file mode 100644
index 0000000..9c5a950
--- /dev/null
+++ b/data/org.pkexec.zenmonitor.policy.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+ <action id="org.pkexec.zenmonitor">
+ <description>Run Zenmonitor as root</description>
+ <message>Authentication is required to run Zenmonitor as root.</message>
+ <defaults>
+ <allow_any>auth_admin</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>auth_admin</allow_active>
+ </defaults>
+ <annotate key="org.freedesktop.policykit.exec.path">@APP_EXEC@</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+ </action>
+
+</policyconfig>
diff --git a/data/zenmonitor-root.desktop.in b/data/zenmonitor-root.desktop.in
new file mode 100644
index 0000000..d8a4442
--- /dev/null
+++ b/data/zenmonitor-root.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Zenmonitor (root)
+Comment=Monitoring software for AMD Zen-based CPUs
+Exec=pkexec @APP_EXEC@
+Type=Application
+Categories=GTK;System;
+Terminal=false
+Keywords=CPU;AMD;zen;system;core;speed;clock;temperature;voltage;
diff --git a/data/zenmonitor.desktop.in b/data/zenmonitor.desktop.in
new file mode 100644
index 0000000..91e583b
--- /dev/null
+++ b/data/zenmonitor.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Zenmonitor
+Comment=Monitoring software for AMD Zen-based CPUs
+Exec=@APP_EXEC@
+Type=Application
+Categories=GTK;System;
+Terminal=false
+Keywords=CPU;AMD;zen;system;core;speed;clock;temperature;voltage;
diff --git a/makefile b/makefile
index be1ac76..dabe5d2 100755
--- a/makefile
+++ b/makefile
@@ -1,5 +1,33 @@
+ifeq ($(PREFIX),)
+ PREFIX := /usr/local
+endif
+
build:
cc -Isrc/include `pkg-config --cflags gtk+-3.0` src/*.c src/ss/*.c -o zenmonitor `pkg-config --libs gtk+-3.0` -lm -no-pie -Wall
+install:
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ install -m 755 zenmonitor $(DESTDIR)$(PREFIX)/bin
+
+ mkdir -p $(DESTDIR)$(PREFIX)/share/applications
+ sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
+ data/zenmonitor.desktop.in > \
+ $(DESTDIR)$(PREFIX)/share/applications/zenmonitor.desktop
+
+install-polkit:
+ sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
+ data/zenmonitor-root.desktop.in > \
+ $(DESTDIR)$(PREFIX)/share/applications/zenmonitor-root.desktop
+
+ sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
+ data/org.pkexec.zenmonitor.policy.in > \
+ $(DESTDIR)/usr/share/polkit-1/actions/org.pkexec.zenmonitor.policy
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/zenmonitor
+ rm -f $(DESTDIR)$(PREFIX)/share/applications/zenmonitor.desktop
+ rm -f $(DESTDIR)$(PREFIX)/share/applications/zenmonitor-root.desktop
+ rm -f $(DESTDIR)/usr/share/polkit-1/actions/org.pkexec.zenmonitor.policy
+
clean:
rm -f zenmonitor