summarylogtreecommitdiffstats
path: root/gg-cap
diff options
context:
space:
mode:
authorcubercsl2022-09-29 22:10:20 +0800
committercubercsl2022-09-29 22:10:20 +0800
commit2db73692a6924060900cb74eb1f187e1cb602437 (patch)
treea523fb2085563ad1ca8c4dea53ee08285566d33d /gg-cap
parent8da4c826207eb2b71466edc5d13947b97e24343c (diff)
downloadaur-2db73692a6924060900cb74eb1f187e1cb602437.tar.gz
[lilac] updated to 0.2.13-3
Diffstat (limited to 'gg-cap')
-rw-r--r--gg-cap33
1 files changed, 20 insertions, 13 deletions
diff --git a/gg-cap b/gg-cap
index 4e1d863770eb..0fb899030ada 100644
--- a/gg-cap
+++ b/gg-cap
@@ -15,16 +15,23 @@ error() {
exit 1
}
-ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope)
-
-case $ptrace_scope in
- 2)
- warn "Your ptrace_scope is 2, give the correct capability to gg."
- /usr/bin/setcap cap_net_raw,cap_sys_ptrace+ep /usr/bin/gg
- ;;
- 3)
- error "Your kernel does not allow ptrace permission, gg may not work."
- ;;
- *)
- echo "No need to setcap."
-esac
+if [[ -f /proc/sys/kernel/yama/ptrace_scope ]]; then
+ ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope)
+ case $ptrace_scope in
+ 2)
+ warn "Your ptrace_scope is 2, give the correct capability to
+gg."
+ /usr/bin/setcap cap_net_raw,cap_sys_ptrace+ep /usr/bin/gg
+ ;;
+ 3)
+ error "Your kernel does not allow ptrace permission, gg may not
+work."
+ ;;
+ *)
+ echo "No need to setcap."
+ esac
+else
+ warn "YAMA support is not enabled in the kernel, still setting
+capabilities..."
+ /usr/bin/setcap cap_net_raw,cap_sys_ptrace+ep /usr/bin/gg
+fi