Package Details: gg 0.2.18-1

Git Clone URL: https://aur.archlinux.org/gg.git (read-only, click to copy)
Package Base: gg
Description: A command-line tool for one-click proxy in your research and development without installing v2ray or anything else (only for linux).
Upstream URL: https://github.com/mzz2017/gg
Licenses: AGPL
Provides: gg
Submitter: cubercsl
Maintainer: cubercsl (mzz2017)
Last Packager: cubercsl
Votes: 3
Popularity: 0.000015
First Submitted: 2021-12-07 11:47 (UTC)
Last Updated: 2023-02-13 08:01 (UTC)

Dependencies (3)

Required by (0)

Sources (3)

Latest Comments

ZhangHua commented on 2022-09-29 13:07 (UTC) (edited on 2022-09-29 13:10 (UTC) by ZhangHua)

gg-cap 可以改成这样以应对 yama 没有开启的情况:

#!/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
}

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

虽然 yama 没有开启这个情况非常稀少,但也可能存在,比如自定义内核关闭了 yama 之类的。 error 函数触发后将导致脚本以 1 的状态码退出,pacman 会给个错误提示脚本执行失败,可考虑移除 exit 1 这行。 另外 libcap 应该是运行时依赖,因为这个 hook 会在安装完成后执行,可选依赖默认不安装,这样的话在一个没有安装 libcap 的系统上执行 hook 就会出问题。

cubercsl commented on 2022-09-28 12:29 (UTC)

@ZhangHua 0.2.13-1 is update automatically, I have fixed it mow.

ZhangHua commented on 2022-09-28 11:31 (UTC)

按照安装脚本的内容,本该设置 capability 的操作在这里并未完成。也许需要把 libcap 放到依赖里面并通过 pacman hook 或者 install 脚本来执行?