summarylogtreecommitdiffstats
path: root/gg-cap
diff options
context:
space:
mode:
authorcubercsl2022-09-28 20:25:35 +0800
committercubercsl2022-09-28 20:25:35 +0800
commit8da4c826207eb2b71466edc5d13947b97e24343c (patch)
tree42962f733c126c423ba0af216962a78b67693f66 /gg-cap
parentb71866dd3c23d4f75851fb2327eefbaf69f544cb (diff)
downloadaur-8da4c826207eb2b71466edc5d13947b97e24343c.tar.gz
[lilac] updated to 0.2.13-2
Diffstat (limited to 'gg-cap')
-rw-r--r--gg-cap30
1 files changed, 30 insertions, 0 deletions
diff --git a/gg-cap b/gg-cap
new file mode 100644
index 000000000000..4e1d863770eb
--- /dev/null
+++ b/gg-cap
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+YELLOW="$(tput setaf 3 2>/dev/null || printf '')"
+RED="$(tput setaf 1 2>/dev/null || printf '')"
+NO_COLOR="$(tput sgr0 2>/dev/null || printf '')"
+
+warn() {
+ printf '%s\n' "${YELLOW}! $*${NO_COLOR}"
+}
+
+error() {
+ printf '%s\n' "${RED}! $*${NO_COLOR}"
+ 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