summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--pacman_hooks/setcap-intel_gpu_top.hook12
-rw-r--r--pacman_hooks/setcap-iotop.hook12
-rw-r--r--pacman_hooks/setcap-nethogs.hook12
4 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e23b26f..7c4b406 100644
--- a/Makefile
+++ b/Makefile
@@ -8,15 +8,20 @@
# https://unix.stackexchange.com/a/740226/459013
SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq
+PACMAN_HOOKS = setcap-intel_gpu_top.hook setcap-iotop.hook setcap-nethogs.hook
PREFIX = /usr/local
install:
mkdir -p ${DESTDIR}${PREFIX}/bin
# Another way would be define and use INSTALL INSTALL_PROGRAM INSTALL_DATA instead of use `cp -f` or `install` directly, see `info make`
for i in ${SH}; do cp -f sh/$$i ${DESTDIR}${PREFIX}/bin; done
+ mkdir -p ${DESTDIR}${PREFIX}/share/libalpm/hooks
+# /usr/local/share/libalpm/hooks default does not work, need to change pacman.conf
+ for i in ${PACMAN_HOOKS}; do cp -f pacman_hooks/$$i ${DESTDIR}${PREFIX}/share/libalpm/hooks; done
uninstall:
for i in ${SH}; do rm -f ${DESTDIR}${PREFIX}/bin/$$i; done
+ for i in ${PACMAN_HOOKS}; do rm -f ${DESTDIR}${PREFIX}/share/libalpm/hooks/$$i; done
# RM is default to `rm -f`, see `info make`
# for i in ${SH}; do ${RM} ${DESTDIR}${PREFIX}/bin/$$i; done
diff --git a/pacman_hooks/setcap-intel_gpu_top.hook b/pacman_hooks/setcap-intel_gpu_top.hook
new file mode 100644
index 0000000..861581e
--- /dev/null
+++ b/pacman_hooks/setcap-intel_gpu_top.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = Package
+Operation = Install
+Operation = Upgrade
+Target = intel-gpu-tools
+
+[Action]
+Description = Set file capabilities for intel_gpu_top...
+When = PostTransaction
+# https://gitlab.freedesktop.org/drm/intel/-/issues/5018
+Exec = /usr/bin/setcap cap_perfmon+ep /usr/bin/intel_gpu_top
+Depends = intel-gpu-tools
diff --git a/pacman_hooks/setcap-iotop.hook b/pacman_hooks/setcap-iotop.hook
new file mode 100644
index 0000000..402a57f
--- /dev/null
+++ b/pacman_hooks/setcap-iotop.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = Package
+Operation = Install
+Operation = Upgrade
+Target = iotop-c
+
+[Action]
+Description = Set file capabilities for iotop...
+When = PostTransaction
+# man iotop
+Exec = /usr/bin/setcap cap_net_admin+eip /usr/bin/iotop
+Depends = iotop-c
diff --git a/pacman_hooks/setcap-nethogs.hook b/pacman_hooks/setcap-nethogs.hook
new file mode 100644
index 0000000..9244449
--- /dev/null
+++ b/pacman_hooks/setcap-nethogs.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = Package
+Operation = Install
+Operation = Upgrade
+Target = nethogs
+
+[Action]
+Description = Set file capabilities for nethogs...
+When = PostTransaction
+# man nethogs
+Exec = /usr/bin/setcap cap_net_admin,cap_net_raw+ep /usr/bin/nethogs
+Depends = nethogs